Start adding memory stuff

This commit is contained in:
wheremyfoodat 2022-09-15 13:35:15 +03:00
parent 2057e0c447
commit 905c7ed770
8 changed files with 77 additions and 10 deletions

View file

@ -17,8 +17,7 @@ using s16 = std::int16_t;
using s32 = std::int32_t;
using s64 = std::int64_t;
class Helpers {
public:
namespace Helpers {
[[noreturn]] static void panic(const char* fmt, ...) {
std::va_list args;
va_start(args, fmt);
@ -133,6 +132,19 @@ public:
}
};
// UDLs for memory size values
constexpr size_t operator""_KB(unsigned long long int x) {
return 1024ULL * x;
}
constexpr size_t operator""_MB(unsigned long long int x) {
return 1024_KB * x;
}
constexpr size_t operator""_GB(unsigned long long int x) {
return 1024_MB * x;
}
// useful macros
// likely/unlikely
#ifdef __GNUC__