[ox/std] Cleanup some enable_ifs
All checks were successful
Build / build (push) Successful in 1m7s

This commit is contained in:
2026-01-21 23:35:19 -06:00
parent 65e3153dda
commit 7477ede222

View File

@@ -17,19 +17,19 @@ namespace ox {
template<typename T> template<typename T>
[[nodiscard]] [[nodiscard]]
constexpr T byteSwap(typename enable_if<sizeof(T) == 1, T>::type i) noexcept { constexpr T byteSwap(T const i) noexcept requires(sizeof(T) == 1) {
return i; return i;
} }
template<typename T> template<typename T>
[[nodiscard]] [[nodiscard]]
constexpr T byteSwap(typename enable_if<sizeof(T) == 2, T>::type i) noexcept { constexpr T byteSwap(T const i) noexcept requires(sizeof(T) == 2) {
return static_cast<T>(i << 8) | static_cast<T>(i >> 8); return static_cast<T>(i << 8) | static_cast<T>(i >> 8);
} }
template<typename T> template<typename T>
[[nodiscard]] [[nodiscard]]
constexpr T byteSwap(typename enable_if<sizeof(T) == 4, T>::type i) noexcept { constexpr T byteSwap(T const i) noexcept requires(sizeof(T) == 4) {
return ((i >> 24) & 0x000000ff) | return ((i >> 24) & 0x000000ff) |
((i >> 8) & 0x0000ff00) | ((i >> 8) & 0x0000ff00) |
((i << 8) & 0x00ff0000) | ((i << 8) & 0x00ff0000) |
@@ -38,7 +38,7 @@ constexpr T byteSwap(typename enable_if<sizeof(T) == 4, T>::type i) noexcept {
template<typename T> template<typename T>
[[nodiscard]] [[nodiscard]]
constexpr T byteSwap(typename enable_if<sizeof(T) == 8, T>::type i) noexcept { constexpr T byteSwap(T const i) noexcept requires(sizeof(T) == 8) {
return ((i >> 56) & 0x00000000000000ff) | return ((i >> 56) & 0x00000000000000ff) |
((i >> 40) & 0x000000000000ff00) | ((i >> 40) & 0x000000000000ff00) |
((i >> 24) & 0x0000000000ff0000) | ((i >> 24) & 0x0000000000ff0000) |