summaryrefslogtreecommitdiff
path: root/kms++util/inc
diff options
context:
space:
mode:
Diffstat (limited to 'kms++util/inc')
-rw-r--r--kms++util/inc/kms++util/endian.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/kms++util/inc/kms++util/endian.h b/kms++util/inc/kms++util/endian.h
index 0f7aecd..e77b3bd 100644
--- a/kms++util/inc/kms++util/endian.h
+++ b/kms++util/inc/kms++util/endian.h
@@ -5,7 +5,7 @@
#include <stdint.h>
static_assert((__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) ||
- (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__),
+ (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__),
"Unable to detect endianness");
enum class endian {
@@ -19,14 +19,17 @@ constexpr T byteswap(T value) noexcept
{
static_assert(std::is_integral<T>(), "Type is not integral");
static_assert(sizeof(T) == 2 ||
- sizeof(T) == 4 ||
- sizeof(T) == 8,
+ sizeof(T) == 4 ||
+ sizeof(T) == 8,
"Illegal value size");
switch (sizeof(T)) {
- case 2: return bswap_16(value);
- case 4: return bswap_32(value);
- case 8: return bswap_64(value);
+ case 2:
+ return bswap_16(value);
+ case 4:
+ return bswap_32(value);
+ case 8:
+ return bswap_64(value);
}
}
@@ -39,8 +42,7 @@ static void write_endian(T* dst, T val)
*dst = val;
}
-[[maybe_unused]]
-static void write16le(uint16_t* dst, uint16_t val)
+[[maybe_unused]] static void write16le(uint16_t* dst, uint16_t val)
{
write_endian<endian::little, uint16_t>(dst, val);
}