Implemented bitfield support into the pattern language

This commit is contained in:
WerWolv
2020-11-20 20:26:19 +01:00
parent 2f78a10e4c
commit e3cb078306
11 changed files with 205 additions and 34 deletions

View File

@@ -75,6 +75,11 @@ namespace hex {
return result;
}
[[nodiscard]] constexpr inline u64 extract(u8 from, u8 to, const u64 &value) {
u64 mask = (std::numeric_limits<u64>::max() >> (63 - (from - to))) << to;
return (value & mask) >> to;
}
class ScopeExit {
public: