Compare commits
3 Commits
592e641ba9
...
7477ede222
| Author | SHA1 | Date | |
|---|---|---|---|
| 7477ede222 | |||
| 65e3153dda | |||
| 53a224cf8f |
8
deps/ox/src/ox/std/byteswap.hpp
vendored
8
deps/ox/src/ox/std/byteswap.hpp
vendored
@@ -17,19 +17,19 @@ namespace ox {
|
||||
|
||||
template<typename T>
|
||||
[[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;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[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);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[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) |
|
||||
((i >> 8) & 0x0000ff00) |
|
||||
((i << 8) & 0x00ff0000) |
|
||||
@@ -38,7 +38,7 @@ constexpr T byteSwap(typename enable_if<sizeof(T) == 4, T>::type i) noexcept {
|
||||
|
||||
template<typename T>
|
||||
[[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) |
|
||||
((i >> 40) & 0x000000000000ff00) |
|
||||
((i >> 24) & 0x0000000000ff0000) |
|
||||
|
||||
4
deps/ox/src/ox/std/concepts.hpp
vendored
4
deps/ox/src/ox/std/concepts.hpp
vendored
@@ -32,4 +32,8 @@ concept Integral_c = ox::is_integral_v<T>;
|
||||
|
||||
template<typename T, size_t max>
|
||||
concept IntegerRange_c = ox::is_integer_v<T> && ox::MaxValue<T> >= max;
|
||||
|
||||
template<typename Union>
|
||||
concept Union_c = is_union_v<Union>;
|
||||
|
||||
}
|
||||
|
||||
2
deps/ox/src/ox/std/strconv.hpp
vendored
2
deps/ox/src/ox/std/strconv.hpp
vendored
@@ -32,7 +32,7 @@ constexpr ox::Error writeItoa(Integer v, ox::Writer_c auto &writer) noexcept {
|
||||
val %= mod;
|
||||
mod /= base;
|
||||
if (it || digit) {
|
||||
ox::ResizedInt_t<Integer, 64> start = '0';
|
||||
constexpr auto start = '0';
|
||||
if (digit >= 10) [[unlikely]] {
|
||||
digit -= 10;
|
||||
OX_RETURN_ERROR(writer.put('1'));
|
||||
|
||||
Reference in New Issue
Block a user