more memory work

This commit is contained in:
CocoSimone
2022-05-16 09:29:55 +02:00
parent 072f5bb847
commit bc3a0ff63a
13 changed files with 242 additions and 9 deletions

View File

@@ -4,6 +4,12 @@
#include <cassert>
namespace natsukashii::util {
template <typename ...Args>
constexpr void panic(const std::string& fmt, Args... args) {
fmt::print(fmt, args...);
exit(-1);
}
template <u8 start, u8 end>
using BitSliceType =
typename std::conditional<(end - start) <= 7, u8,
@@ -29,4 +35,5 @@ T BitSlice(const T& num, int start, int end) {
auto correctedEnd = end == (sizeof(T) * 8) - 1 ? end : end + 1;
return (num >> start) & ((1 << correctedEnd) - 1);
}
}