58 unsigned char *bytes =
reinterpret_cast<unsigned char *
>(&t);
60 if constexpr (
sizeof(T) == 2) { std::swap(bytes[0], bytes[1]); }
61 else if constexpr (
sizeof(T) == 4)
63 std::swap(bytes[0], bytes[3]);
64 std::swap(bytes[1], bytes[2]);
66 else if constexpr (
sizeof(T) == 8)
68 std::swap(bytes[0], bytes[7]);
69 std::swap(bytes[1], bytes[6]);
70 std::swap(bytes[2], bytes[5]);
71 std::swap(bytes[3], bytes[4]);