9 struct ByteswapFunction {
10 template<concepts::IntegralOrEnum T>
11 requires(concepts::UniqueObjectRepresentation<T>)
12 constexpr auto operator()(T
value)
const -> T {
13 if constexpr (concepts::Enum<T>) {
16 if constexpr (
sizeof(T) == 1) {
18 }
else if constexpr (
sizeof(T) == 2) {
19 return __builtin_bswap16(value);
20 }
else if constexpr (
sizeof(T) == 4) {
21 return __builtin_bswap32(value);
22 }
else if constexpr (
sizeof(T) == 8) {
23 return __builtin_bswap64(value);
25#ifdef DI_HAVE_128_BIT_INTEGERS
26 else if constexpr (
sizeof(T) == 16) {
27 return __builtin_bswap128(value);
31 static_assert(concepts::AlwaysFalse<T>);
38constexpr inline auto byteswap = detail::ByteswapFunction {};
Definition bit_proxy_reference.h:5
constexpr auto byteswap
Definition byteswap.h:38
constexpr auto value
Definition value.h:34
constexpr auto to_underlying
Definition to_underlying.h:15
Definition any_storable.h:9