diff --git a/libc/src/string/memory_utils/op_generic.h b/libc/src/string/memory_utils/op_generic.h index b2c8fa2c599a9..3e296857a05a3 100644 --- a/libc/src/string/memory_utils/op_generic.h +++ b/libc/src/string/memory_utils/op_generic.h @@ -331,11 +331,13 @@ template LIBC_INLINE static T load_be(CPtr ptr, size_t offset) { // Equality: returns true iff values at locations (p1 + offset) and (p2 + // offset) compare equal. -template static bool eq(CPtr p1, CPtr p2, size_t offset); +template +LIBC_INLINE static bool eq(CPtr p1, CPtr p2, size_t offset); // Not equals: returns non-zero iff values at locations (p1 + offset) and (p2 + // offset) differ. -template static uint32_t neq(CPtr p1, CPtr p2, size_t offset); +template +LIBC_INLINE static uint32_t neq(CPtr p1, CPtr p2, size_t offset); // Lexicographic comparison: // - returns 0 iff values at locations (p1 + offset) and (p2 + offset) compare @@ -345,7 +347,7 @@ template static uint32_t neq(CPtr p1, CPtr p2, size_t offset); // - returns a positive value if value at location (p1 + offset) is // lexicographically greater than value at (p2 + offset). template -static MemcmpReturnType cmp(CPtr p1, CPtr p2, size_t offset); +LIBC_INLINE static MemcmpReturnType cmp(CPtr p1, CPtr p2, size_t offset); // Lexicographic comparison of non-equal values: // - returns a negative value if value at location (p1 + offset) is @@ -353,7 +355,7 @@ static MemcmpReturnType cmp(CPtr p1, CPtr p2, size_t offset); // - returns a positive value if value at location (p1 + offset) is // lexicographically greater than value at (p2 + offset). template -static MemcmpReturnType cmp_neq(CPtr p1, CPtr p2, size_t offset); +LIBC_INLINE static MemcmpReturnType cmp_neq(CPtr p1, CPtr p2, size_t offset); /////////////////////////////////////////////////////////////////////////////// // Memcmp implementation diff --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h index 1d82706eef49c..a0c8d3aba4e80 100644 --- a/libc/src/string/memory_utils/op_x86.h +++ b/libc/src/string/memory_utils/op_x86.h @@ -40,12 +40,12 @@ namespace __llvm_libc::x86 { // A set of constants to check compile time features. -static LIBC_INLINE constexpr bool kSse2 = LLVM_LIBC_IS_DEFINED(__SSE2__); -static LIBC_INLINE constexpr bool kSse41 = LLVM_LIBC_IS_DEFINED(__SSE4_1__); -static LIBC_INLINE constexpr bool kAvx = LLVM_LIBC_IS_DEFINED(__AVX__); -static LIBC_INLINE constexpr bool kAvx2 = LLVM_LIBC_IS_DEFINED(__AVX2__); -static LIBC_INLINE constexpr bool kAvx512F = LLVM_LIBC_IS_DEFINED(__AVX512F__); -static LIBC_INLINE constexpr bool kAvx512BW = +LIBC_INLINE static constexpr bool kSse2 = LLVM_LIBC_IS_DEFINED(__SSE2__); +LIBC_INLINE static constexpr bool kSse41 = LLVM_LIBC_IS_DEFINED(__SSE4_1__); +LIBC_INLINE static constexpr bool kAvx = LLVM_LIBC_IS_DEFINED(__AVX__); +LIBC_INLINE static constexpr bool kAvx2 = LLVM_LIBC_IS_DEFINED(__AVX2__); +LIBC_INLINE static constexpr bool kAvx512F = LLVM_LIBC_IS_DEFINED(__AVX512F__); +LIBC_INLINE static constexpr bool kAvx512BW = LLVM_LIBC_IS_DEFINED(__AVX512BW__); /////////////////////////////////////////////////////////////////////////////// @@ -130,7 +130,8 @@ LIBC_INLINE __m128i bytewise_reverse(__m128i value) { 8, 9, 10, 11, 12, 13, 14, 15)); } LIBC_INLINE uint16_t big_endian_cmp_mask(__m128i max, __m128i value) { - return _mm_movemask_epi8(bytewise_reverse(_mm_cmpeq_epi8(max, value))); + return static_cast( + _mm_movemask_epi8(bytewise_reverse(_mm_cmpeq_epi8(max, value)))); } template <> LIBC_INLINE bool eq<__m128i>(CPtr p1, CPtr p2, size_t offset) { const auto a = load<__m128i>(p1, offset);