@@ -872,8 +872,13 @@ template <typename T> std::string toBinaryString(T b) {
872
872
#ifndef IS_UTF8_IMPLEMENTATION_ARM64
873
873
#define IS_UTF8_IMPLEMENTATION_ARM64 (IS_UTF8_IS_ARM64)
874
874
#endif
875
- #define IS_UTF8_CAN_ALWAYS_RUN_ARM64 \
876
- IS_UTF8_IMPLEMENTATION_ARM64 &&IS_UTF8_IS_ARM64
875
+
876
+ #if IS_UTF8_IMPLEMENTATION_ARM64 &&IS_UTF8_IS_ARM64
877
+ #define IS_UTF8_CAN_ALWAYS_RUN_ARM64 1
878
+ #else
879
+ #define IS_UTF8_CAN_ALWAYS_RUN_ARM64 0
880
+ #endif
881
+
877
882
878
883
#if IS_UTF8_IMPLEMENTATION_ARM64
879
884
@@ -1116,8 +1121,9 @@ template <typename T, typename Mask = simd8<bool>> struct base_u8 {
1116
1121
return *this_cast;
1117
1122
}
1118
1123
1119
- is_utf8_really_inline Mask operator==(const simd8<T> other) const {
1120
- return vceqq_u8(*this, other);
1124
+ friend is_utf8_really_inline Mask operator==(const simd8<T> lhs,
1125
+ const simd8<T> rhs) {
1126
+ return vceqq_u8(lhs, rhs);
1121
1127
}
1122
1128
1123
1129
template <int N = 1>
@@ -2172,7 +2178,7 @@ namespace icelake {} // namespace icelake
2172
2178
// We should not get warnings while including <x86intrin.h> yet we do
2173
2179
// under some versions of GCC.
2174
2180
// If the x86intrin.h header has uninitialized values that are problematic,
2175
- // it is a GCC issue, we want to ignore these warnigns .
2181
+ // it is a GCC issue, we want to ignore these warnings .
2176
2182
IS_UTF8_DISABLE_GCC_WARNING(-Wuninitialized)
2177
2183
#endif
2178
2184
@@ -2342,8 +2348,11 @@ IS_UTF8_POP_DISABLE_WARNINGS
2342
2348
#endif
2343
2349
// To see why (__BMI__) && (__PCLMUL__) && (__LZCNT__) are not part of this
2344
2350
// next line, see https://github.com/simdutf/simdutf/issues/1247
2345
- #define IS_UTF8_CAN_ALWAYS_RUN_HASWELL \
2346
- ((IS_UTF8_IMPLEMENTATION_HASWELL) && (IS_UTF8_IS_X86_64) && (__AVX2__))
2351
+ #if ((IS_UTF8_IMPLEMENTATION_HASWELL) && (IS_UTF8_IS_X86_64) && (__AVX2__))
2352
+ #define IS_UTF8_CAN_ALWAYS_RUN_HASWELL 1
2353
+ #else
2354
+ #define IS_UTF8_CAN_ALWAYS_RUN_HASWELL 0
2355
+ #endif
2347
2356
2348
2357
#if IS_UTF8_IMPLEMENTATION_HASWELL
2349
2358
@@ -2398,7 +2407,7 @@ class implementation final : public is_utf8_internals::implementation {
2398
2407
// We should not get warnings while including <x86intrin.h> yet we do
2399
2408
// under some versions of GCC.
2400
2409
// If the x86intrin.h header has uninitialized values that are problematic,
2401
- // it is a GCC issue, we want to ignore these warnigns .
2410
+ // it is a GCC issue, we want to ignore these warnings .
2402
2411
IS_UTF8_DISABLE_GCC_WARNING (-Wuninitialized)
2403
2412
#endif
2404
2413
@@ -2539,8 +2548,9 @@ struct base8 : base<simd8<T>> {
2539
2548
is_utf8_really_inline T last () const {
2540
2549
return _mm256_extract_epi8 (*this , 31 );
2541
2550
}
2542
- is_utf8_really_inline Mask operator ==(const simd8<T> other) const {
2543
- return _mm256_cmpeq_epi8 (*this , other);
2551
+ friend is_utf8_really_inline Mask operator ==(const simd8<T> lhs,
2552
+ const simd8<T> rhs) {
2553
+ return _mm256_cmpeq_epi8 (lhs, rhs);
2544
2554
}
2545
2555
2546
2556
static const int SIZE = sizeof (base<T>::value);
@@ -2965,8 +2975,9 @@ struct base16 : base<simd16<T>> {
2965
2975
is_utf8_really_inline base16 (const Pointer *ptr)
2966
2976
: base16(_mm256_loadu_si256(reinterpret_cast <const __m256i *>(ptr))) {}
2967
2977
2968
- is_utf8_really_inline Mask operator ==(const simd16<T> other) const {
2969
- return _mm256_cmpeq_epi16 (*this , other);
2978
+ friend is_utf8_really_inline Mask operator ==(const simd16<T> lhs,
2979
+ const simd16<T> rhs) {
2980
+ return _mm256_cmpeq_epi16 (lhs, rhs);
2970
2981
}
2971
2982
2972
2983
// / the size of vector in bytes
@@ -3340,9 +3351,11 @@ IS_UTF8_UNTARGET_REGION
3340
3351
3341
3352
#endif
3342
3353
3343
- #define IS_UTF8_CAN_ALWAYS_RUN_WESTMERE \
3344
- (IS_UTF8_IMPLEMENTATION_WESTMERE && IS_UTF8_IS_X86_64 && __SSE4_2__ && \
3345
- __PCLMUL__)
3354
+ #if IS_UTF8_IMPLEMENTATION_WESTMERE && IS_UTF8_IS_X86_64 && __SSE4_2__ && __PCLMUL__
3355
+ #define IS_UTF8_CAN_ALWAYS_RUN_WESTMERE 1
3356
+ #else
3357
+ #define IS_UTF8_CAN_ALWAYS_RUN_WESTMERE 0
3358
+ #endif
3346
3359
3347
3360
#if IS_UTF8_IMPLEMENTATION_WESTMERE
3348
3361
@@ -3395,7 +3408,7 @@ class implementation final : public is_utf8_internals::implementation {
3395
3408
// We should not get warnings while including <x86intrin.h> yet we do
3396
3409
// under some versions of GCC.
3397
3410
// If the x86intrin.h header has uninitialized values that are problematic,
3398
- // it is a GCC issue, we want to ignore these warnigns .
3411
+ // it is a GCC issue, we want to ignore these warnings .
3399
3412
IS_UTF8_DISABLE_GCC_WARNING (-Wuninitialized)
3400
3413
#endif
3401
3414
@@ -3517,8 +3530,9 @@ struct base8 : base<simd8<T>> {
3517
3530
is_utf8_really_inline base8 () : base<simd8<T>>() {}
3518
3531
is_utf8_really_inline base8 (const __m128i _value) : base<simd8<T>>(_value) {}
3519
3532
3520
- is_utf8_really_inline Mask operator ==(const simd8<T> other) const {
3521
- return _mm_cmpeq_epi8 (*this , other);
3533
+ friend is_utf8_really_inline Mask operator ==(const simd8<T> lhs,
3534
+ const simd8<T> rhs) {
3535
+ return _mm_cmpeq_epi8 (lhs, rhs);
3522
3536
}
3523
3537
3524
3538
static const int SIZE = sizeof (base<simd8<T>>::value);
@@ -4032,8 +4046,9 @@ struct base16 : base<simd16<T>> {
4032
4046
is_utf8_really_inline base16 (const Pointer *ptr)
4033
4047
: base16(_mm_loadu_si128(reinterpret_cast <const __m128i *>(ptr))) {}
4034
4048
4035
- is_utf8_really_inline Mask operator ==(const simd16<T> other) const {
4036
- return _mm_cmpeq_epi16 (*this , other);
4049
+ friend is_utf8_really_inline Mask operator ==(const simd16<T> lhs,
4050
+ const simd16<T> rhs) {
4051
+ return _mm_cmpeq_epi16 (lhs, rhs);
4037
4052
}
4038
4053
4039
4054
static const int SIZE = sizeof (base<simd16<T>>::value);
@@ -4407,7 +4422,11 @@ IS_UTF8_UNTARGET_REGION
4407
4422
#endif
4408
4423
#endif
4409
4424
4410
- #define IS_UTF8_CAN_ALWAYS_RUN_FALLBACK (IS_UTF8_IMPLEMENTATION_FALLBACK)
4425
+ #if IS_UTF8_IMPLEMENTATION_FALLBACK
4426
+ #define IS_UTF8_CAN_ALWAYS_RUN_FALLBACK 1
4427
+ #else
4428
+ #define IS_UTF8_CAN_ALWAYS_RUN_FALLBACK 0
4429
+ #endif
4411
4430
4412
4431
#if IS_UTF8_IMPLEMENTATION_FALLBACK
4413
4432
0 commit comments