1
0
mirror of synced 2024-11-12 02:00:52 +01:00

Use hex::integral instead of std::integral concept

This commit is contained in:
WerWolv 2021-01-02 22:24:52 +01:00
parent 9a968674d6
commit 4189700a3b

View File

@ -12,7 +12,6 @@
#ifdef __MINGW32__
#include <winsock.h>
#else
#include <arpa/inet.h>
#endif
@ -94,7 +93,7 @@ namespace hex {
return (value & mask) >> to;
}
template<std::integral T>
template<hex::integral T>
[[nodiscard]] constexpr inline T signExtend(T value, u8 currWidth, u8 targetWidth) {
T mask = 1LLU << (currWidth - 1);
return (((value ^ mask) - mask) << ((sizeof(T) * 8) - targetWidth)) >> ((sizeof(T) * 8) - targetWidth);