// Equality: returns true iff values at locations (p1 + offset) and (p2 +
// offset) compare equal.
-template <typename T> static bool eq(CPtr p1, CPtr p2, size_t offset);
+template <typename T>
+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 <typename T> static uint32_t neq(CPtr p1, CPtr p2, size_t offset);
+template <typename T>
+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
// - returns a positive value if value at location (p1 + offset) is
// lexicographically greater than value at (p2 + offset).
template <typename T>
-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
// - returns a positive value if value at location (p1 + offset) is
// lexicographically greater than value at (p2 + offset).
template <typename T>
-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
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__);
///////////////////////////////////////////////////////////////////////////////
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<uint16_t>(
+ _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);