1414
1515// Zero-extending helper
1616template <typename TReturn, typename TValue>
17- ALWAYS_INLINE static constexpr TReturn ZeroExtend (TValue value)
17+ ALWAYS_INLINE constexpr TReturn ZeroExtend (TValue value)
1818{
1919 return static_cast <TReturn>(static_cast <typename std::make_unsigned<TReturn>::type>(
2020 static_cast <typename std::make_unsigned<TValue>::type>(value)));
2121}
2222// Sign-extending helper
2323template <typename TReturn, typename TValue>
24- ALWAYS_INLINE static constexpr TReturn SignExtend (TValue value)
24+ ALWAYS_INLINE constexpr TReturn SignExtend (TValue value)
2525{
2626 return static_cast <TReturn>(
2727 static_cast <typename std::make_signed<TReturn>::type>(static_cast <typename std::make_signed<TValue>::type>(value)));
2828}
2929
3030// Type-specific helpers
3131template <typename TValue>
32- ALWAYS_INLINE static constexpr u16 ZeroExtend16 (TValue value)
32+ ALWAYS_INLINE constexpr u16 ZeroExtend16 (TValue value)
3333{
3434 return ZeroExtend<u16 , TValue>(value);
3535}
3636template <typename TValue>
37- ALWAYS_INLINE static constexpr u32 ZeroExtend32 (TValue value)
37+ ALWAYS_INLINE constexpr u32 ZeroExtend32 (TValue value)
3838{
3939 return ZeroExtend<u32 , TValue>(value);
4040}
4141template <typename TValue>
42- ALWAYS_INLINE static constexpr u64 ZeroExtend64 (TValue value)
42+ ALWAYS_INLINE constexpr u64 ZeroExtend64 (TValue value)
4343{
4444 return ZeroExtend<u64 , TValue>(value);
4545}
4646template <typename TValue>
47- ALWAYS_INLINE static constexpr u16 SignExtend16 (TValue value)
47+ ALWAYS_INLINE constexpr u16 SignExtend16 (TValue value)
4848{
4949 return SignExtend<u16 , TValue>(value);
5050}
5151template <typename TValue>
52- ALWAYS_INLINE static constexpr u32 SignExtend32 (TValue value)
52+ ALWAYS_INLINE constexpr u32 SignExtend32 (TValue value)
5353{
5454 return SignExtend<u32 , TValue>(value);
5555}
5656template <typename TValue>
57- ALWAYS_INLINE static constexpr u64 SignExtend64 (TValue value)
57+ ALWAYS_INLINE constexpr u64 SignExtend64 (TValue value)
5858{
5959 return SignExtend<u64 , TValue>(value);
6060}
6161template <typename TValue>
62- ALWAYS_INLINE static constexpr u8 Truncate8 (TValue value)
62+ ALWAYS_INLINE constexpr u8 Truncate8 (TValue value)
6363{
6464 return static_cast <u8 >(static_cast <typename std::make_unsigned<decltype (value)>::type>(value));
6565}
6666template <typename TValue>
67- ALWAYS_INLINE static constexpr u16 Truncate16 (TValue value)
67+ ALWAYS_INLINE constexpr u16 Truncate16 (TValue value)
6868{
6969 return static_cast <u16 >(static_cast <typename std::make_unsigned<decltype (value)>::type>(value));
7070}
7171template <typename TValue>
72- ALWAYS_INLINE static constexpr u32 Truncate32 (TValue value)
72+ ALWAYS_INLINE constexpr u32 Truncate32 (TValue value)
7373{
7474 return static_cast <u32 >(static_cast <typename std::make_unsigned<decltype (value)>::type>(value));
7575}
7676
7777// BCD helpers
78- ALWAYS_INLINE static constexpr u8 BinaryToBCD (u8 value)
78+ ALWAYS_INLINE constexpr u8 BinaryToBCD (u8 value)
7979{
8080 return ((value / 10 ) << 4 ) + (value % 10 );
8181}
82- ALWAYS_INLINE static constexpr u8 PackedBCDToBinary (u8 value)
82+ ALWAYS_INLINE constexpr u8 PackedBCDToBinary (u8 value)
8383{
8484 return ((value >> 4 ) * 10 ) + (value % 16 );
8585}
86- ALWAYS_INLINE static constexpr u8 IsValidBCDDigit (u8 digit)
86+ ALWAYS_INLINE constexpr u8 IsValidBCDDigit (u8 digit)
8787{
8888 return (digit <= 9 );
8989}
90- ALWAYS_INLINE static constexpr u8 IsValidPackedBCD (u8 value)
90+ ALWAYS_INLINE constexpr u8 IsValidPackedBCD (u8 value)
9191{
9292 return IsValidBCDDigit (value & 0x0F ) && IsValidBCDDigit (value >> 4 );
9393}
9494
9595// Boolean to integer
96- ALWAYS_INLINE static constexpr u8 BoolToUInt8 (bool value)
96+ ALWAYS_INLINE constexpr u8 BoolToUInt8 (bool value)
9797{
9898 return static_cast <u8 >(value);
9999}
100- ALWAYS_INLINE static constexpr u16 BoolToUInt16 (bool value)
100+ ALWAYS_INLINE constexpr u16 BoolToUInt16 (bool value)
101101{
102102 return static_cast <u16 >(value);
103103}
104- ALWAYS_INLINE static constexpr u32 BoolToUInt32 (bool value)
104+ ALWAYS_INLINE constexpr u32 BoolToUInt32 (bool value)
105105{
106106 return static_cast <u32 >(value);
107107}
108- ALWAYS_INLINE static constexpr u64 BoolToUInt64 (bool value)
108+ ALWAYS_INLINE constexpr u64 BoolToUInt64 (bool value)
109109{
110110 return static_cast <u64 >(value);
111111}
112- ALWAYS_INLINE static constexpr float BoolToFloat (bool value)
112+ ALWAYS_INLINE constexpr float BoolToFloat (bool value)
113113{
114114 return static_cast <float >(value);
115115}
116116
117117// Integer to boolean
118118template <typename TValue>
119- ALWAYS_INLINE static constexpr bool ConvertToBool (TValue value)
119+ ALWAYS_INLINE constexpr bool ConvertToBool (TValue value)
120120{
121121 return static_cast <bool >(value);
122122}
123123
124124// Unsafe integer to boolean
125125template <typename TValue>
126- ALWAYS_INLINE static bool ConvertToBoolUnchecked (TValue value)
126+ ALWAYS_INLINE bool ConvertToBoolUnchecked (TValue value)
127127{
128128 // static_assert(sizeof(uint8) == sizeof(bool));
129129 bool ret;
@@ -133,7 +133,7 @@ ALWAYS_INLINE static bool ConvertToBoolUnchecked(TValue value)
133133
134134// Generic sign extension
135135template <int NBITS, typename T>
136- ALWAYS_INLINE static constexpr T SignExtendN (T value)
136+ ALWAYS_INLINE constexpr T SignExtendN (T value)
137137{
138138 // http://graphics.stanford.edu/~seander/bithacks.html#VariableSignExtend
139139 constexpr int shift = 8 * sizeof (T) - NBITS;
@@ -142,7 +142,7 @@ ALWAYS_INLINE static constexpr T SignExtendN(T value)
142142
143143// / Returns the number of zero bits before the first set bit, going MSB->LSB.
144144template <typename T>
145- ALWAYS_INLINE static unsigned CountLeadingZeros (T value)
145+ ALWAYS_INLINE unsigned CountLeadingZeros (T value)
146146{
147147#ifdef _MSC_VER
148148 if constexpr (sizeof (value) >= sizeof (u64 ))
@@ -169,7 +169,7 @@ ALWAYS_INLINE static unsigned CountLeadingZeros(T value)
169169
170170// / Returns the number of zero bits before the first set bit, going LSB->MSB.
171171template <typename T>
172- ALWAYS_INLINE static unsigned CountTrailingZeros (T value)
172+ ALWAYS_INLINE unsigned CountTrailingZeros (T value)
173173{
174174#ifdef _MSC_VER
175175 if constexpr (sizeof (value) >= sizeof (u64 ))
@@ -194,7 +194,7 @@ ALWAYS_INLINE static unsigned CountTrailingZeros(T value)
194194
195195// C++23-like std::byteswap()
196196template <typename T>
197- ALWAYS_INLINE static T ByteSwap (T value)
197+ ALWAYS_INLINE T ByteSwap (T value)
198198{
199199 if constexpr (std::is_signed_v<T>)
200200 {
0 commit comments