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