From 016577dbeced3c10cb3117fb31594751b4239b62 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 22 Jan 2024 16:56:18 +0100 Subject: [PATCH] endian: mark one-byte "swap" functions as constexpr While being here only for templates to work with various data types, the one-byte "swap" functions are actually noop. Signed-off-by: Simon Rozman --- include/stdex/endian.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/stdex/endian.hpp b/include/stdex/endian.hpp index c92d3557c..32e7dc318 100644 --- a/include/stdex/endian.hpp +++ b/include/stdex/endian.hpp @@ -43,7 +43,7 @@ namespace stdex { - inline uint8_t byteswap(_In_ const uint8_t value) + inline constexpr uint8_t byteswap(_In_ const uint8_t value) { return value; } @@ -95,8 +95,8 @@ namespace stdex #endif } - inline int8_t byteswap(_In_ const char value) { return byteswap(static_cast(value)); } - inline int8_t byteswap(_In_ const int8_t value) { return byteswap(static_cast(value)); } + inline constexpr int8_t byteswap(_In_ const char value) { return byteswap(static_cast(value)); } + inline constexpr int8_t byteswap(_In_ const int8_t value) { return byteswap(static_cast(value)); } inline int16_t byteswap(_In_ const int16_t value) { return byteswap(static_cast(value)); } inline int32_t byteswap(_In_ const int32_t value) { return byteswap(static_cast(value)); } inline int64_t byteswap(_In_ const int64_t value) { return byteswap(static_cast(value)); }