mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
Use hex::integral instead of std::integral concept
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user