|
@ -12,7 +12,7 @@ namespace gp { |
|
|
using endian = std::endian; |
|
|
using endian = std::endian; |
|
|
|
|
|
|
|
|
template <typename T> |
|
|
template <typename T> |
|
|
T swap_endian(T value) { |
|
|
|
|
|
|
|
|
T swap_endian(T value) k">noexcept { |
|
|
union { |
|
|
union { |
|
|
T v; |
|
|
T v; |
|
|
uint8_t u8[sizeof(T)]; |
|
|
uint8_t u8[sizeof(T)]; |
|
@ -48,7 +48,7 @@ struct endian_wrapper { |
|
|
return *this; |
|
|
return *this; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
operator T() { |
|
|
|
|
|
|
|
|
operator T() k">const noexcept { |
|
|
return mode == endian::native ? value : swap_endian(value); |
|
|
return mode == endian::native ? value : swap_endian(value); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|