[ox/std] Fix implementation of std cmp functions
All checks were successful
Build / build (push) Successful in 1m13s

This commit is contained in:
Gary Talent 2025-05-23 00:49:47 -05:00
parent a40198ab8d
commit 27cce3eca6

View File

@ -32,9 +32,9 @@ constexpr bool cmp_equal(T const t, U const u) noexcept {
if constexpr(ox::is_signed_v<T> == ox::is_signed_v<U>) {
return t == u;
} else if constexpr(ox::is_signed_v<T>) {
return ox::Signed<T>{t} == u;
return t >= 0 && static_cast<ox::Unsigned<T>>(t) == u;
} else {
return t == ox::Signed<U>{u};
return u >= 0 && t == static_cast<ox::Unsigned<U>>(u);
}
}
@ -43,9 +43,9 @@ constexpr bool cmp_less(T const t, U const u) noexcept {
if constexpr(ox::is_signed_v<T> == ox::is_signed_v<U>) {
return t < u;
} else if constexpr(ox::is_signed_v<T>) {
return ox::Signed<T>{t} < u;
return t >= 0 && static_cast<ox::Unsigned<T>>(t) < u;
} else {
return t < ox::Signed<U>{u};
return u >= 0 && t < static_cast<ox::Unsigned<U>>(u);
}
}