16 changes: 8 additions & 8 deletions libc/src/string/memory_utils/op_builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,22 @@ template <size_t Size> struct Bcmp {
LIBC_INLINE static BcmpReturnType block(CPtr, CPtr) {
static_assert(cpp::always_false<decltype(Size)>,
"Missing __builtin_memcmp_inline");
return BcmpReturnType::ZERO();
return BcmpReturnType::zero();
}

LIBC_INLINE static BcmpReturnType tail(CPtr, CPtr, size_t) {
static_assert(cpp::always_false<decltype(Size)>, "Not implemented");
return BcmpReturnType::ZERO();
return BcmpReturnType::zero();
}

LIBC_INLINE static BcmpReturnType head_tail(CPtr, CPtr, size_t) {
static_assert(cpp::always_false<decltype(Size)>, "Not implemented");
return BcmpReturnType::ZERO();
return BcmpReturnType::zero();
}

LIBC_INLINE static BcmpReturnType loop_and_tail(CPtr, CPtr, size_t) {
static_assert(cpp::always_false<decltype(Size)>, "Not implemented");
return BcmpReturnType::ZERO();
return BcmpReturnType::zero();
}
};

Expand All @@ -132,22 +132,22 @@ template <size_t Size> struct Memcmp {
LIBC_INLINE static MemcmpReturnType block(CPtr, CPtr) {
static_assert(cpp::always_false<decltype(Size)>,
"Missing __builtin_memcmp_inline");
return MemcmpReturnType::ZERO();
return MemcmpReturnType::zero();
}

LIBC_INLINE static MemcmpReturnType tail(CPtr, CPtr, size_t) {
static_assert(cpp::always_false<decltype(Size)>, "Not implemented");
return MemcmpReturnType::ZERO();
return MemcmpReturnType::zero();
}

LIBC_INLINE static MemcmpReturnType head_tail(CPtr, CPtr, size_t) {
static_assert(cpp::always_false<decltype(Size)>, "Not implemented");
return MemcmpReturnType::ZERO();
return MemcmpReturnType::zero();
}

LIBC_INLINE static MemcmpReturnType loop_and_tail(CPtr, CPtr, size_t) {
static_assert(cpp::always_false<decltype(Size)>, "Not implemented");
return MemcmpReturnType::ZERO();
return MemcmpReturnType::zero();
}
};

Expand Down
10 changes: 5 additions & 5 deletions libc/src/string/memory_utils/op_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ template <typename T> struct Memcmp {
if constexpr (cmp_is_expensive<T>::value) {
if (!eq<T>(p1, p2, offset))
return cmp_neq<T>(p1, p2, offset);
return MemcmpReturnType::ZERO();
return MemcmpReturnType::zero();
} else {
return cmp<T>(p1, p2, offset);
}
Expand Down Expand Up @@ -443,7 +443,7 @@ template <typename T> struct Memcmp {
for (; offset < count; offset += SIZE)
if (auto value = cmp<T>(p1, p2, offset))
return value;
return MemcmpReturnType::ZERO();
return MemcmpReturnType::zero();
}
}

Expand Down Expand Up @@ -475,7 +475,7 @@ template <typename T, typename... TS> struct MemcmpSequence {
if constexpr (sizeof...(TS) > 0)
return MemcmpSequence<TS...>::block(p1 + sizeof(T), p2 + sizeof(T));
else
return MemcmpReturnType::ZERO();
return MemcmpReturnType::zero();
}
};

Expand Down Expand Up @@ -521,7 +521,7 @@ template <typename T> struct Bcmp {
for (; offset < count; offset += SIZE)
if (const auto value = neq<T>(p1, p2, offset))
return value;
return BcmpReturnType::ZERO();
return BcmpReturnType::zero();
}
}

Expand All @@ -547,7 +547,7 @@ template <typename T, typename... TS> struct BcmpSequence {
if constexpr (sizeof...(TS) > 0)
return BcmpSequence<TS...>::block(p1 + sizeof(T), p2 + sizeof(T));
else
return BcmpReturnType::ZERO();
return BcmpReturnType::zero();
}
};

Expand Down
4 changes: 2 additions & 2 deletions libc/src/string/memory_utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ template <typename T> struct StrictIntegralType {
}

// Helper to get the zero value.
LIBC_INLINE static constexpr StrictIntegralType ZERO() { return {T(0)}; }
LIBC_INLINE static constexpr StrictIntegralType NONZERO() { return {T(1)}; }
LIBC_INLINE static constexpr StrictIntegralType zero() { return {T(0)}; }
LIBC_INLINE static constexpr StrictIntegralType nonzero() { return {T(1)}; }

private:
T value;
Expand Down
2 changes: 1 addition & 1 deletion libc/src/string/memory_utils/x86_64/inline_bcmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ inline_bcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) {
[[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_x86(CPtr p1, CPtr p2,
size_t count) {
if (count == 0)
return BcmpReturnType::ZERO();
return BcmpReturnType::zero();
if (count == 1)
return generic::Bcmp<uint8_t>::block(p1, p2);
if (count == 2)
Expand Down
2 changes: 1 addition & 1 deletion libc/src/string/memory_utils/x86_64/inline_memcmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ inline_memcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) {

LIBC_INLINE MemcmpReturnType inline_memcmp_x86(CPtr p1, CPtr p2, size_t count) {
if (count == 0)
return MemcmpReturnType::ZERO();
return MemcmpReturnType::zero();
if (count == 1)
return generic::Memcmp<uint8_t>::block(p1, p2);
if (count == 2)
Expand Down