From 0011a82593c4ce832fa369c1db90850adebe09e8 Mon Sep 17 00:00:00 2001 From: "liuqiang.06" Date: Thu, 16 Jan 2025 11:26:44 +0800 Subject: [PATCH] fix: add missed subr --- base64x_subr_amd64.go | 18 ++++++++++++++++++ native/native.h | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 base64x_subr_amd64.go diff --git a/base64x_subr_amd64.go b/base64x_subr_amd64.go new file mode 100644 index 0000000..488840c --- /dev/null +++ b/base64x_subr_amd64.go @@ -0,0 +1,18 @@ + + +package base64x + +import ( + "github.com/cloudwego/base64x/internal/native" +) + +// HACK: maintain these only to prevent breakchange, because sonic-go linkname these +var ( + _subr__b64decode uintptr + _subr__b64encode uintptr +) + +func init() { + _subr__b64decode = native.S_b64decode + _subr__b64encode = native.S_b64encode +} \ No newline at end of file diff --git a/native/native.h b/native/native.h index 44ec20b..bbb8e14 100644 --- a/native/native.h +++ b/native/native.h @@ -90,7 +90,7 @@ static always_inline void do_b64encode(struct slice_t *out, const struct slice_t /* SIMD 24 bytes loop, but the SIMD instruction will load 4 bytes * past the end, so it's safe only if there are 28 bytes or more left */ -#ifdef USE_AVX2 +#ifdef __AVX2__ while (ip <= ie - 28) { __m128i v0 = _mm_loadu_si128 (as_m128c(ip)); __m128i v1 = _mm_loadu_si128 (as_m128c(ip + 12));