Use physical address for indexing into blocks
This commit is contained in:
@@ -85,4 +85,22 @@ inline u32 crc32(u32 crc, const u8 *buf, size_t len) {
|
||||
}
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
inline void* aligned_alloc(size_t alignment, size_t size) {
|
||||
return _aligned_malloc(size, alignment);
|
||||
}
|
||||
|
||||
inline void free(void* ptr) {
|
||||
_aligned_free(ptr);
|
||||
}
|
||||
#else
|
||||
inline void* aligned_alloc(size_t alignment, size_t size) {
|
||||
return std::aligned_alloc(alignment, size);
|
||||
}
|
||||
|
||||
inline void free(void* ptr) {
|
||||
std::free(ptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -13,7 +13,6 @@ constexpr void print(const std::string& fmt, Args... args) {
|
||||
#ifndef _WIN32
|
||||
if constexpr(messageType == Error) {
|
||||
fmt::print(fmt::emphasis::bold | fg(fmt::color::red), fmt, args...);
|
||||
exit(-1);
|
||||
} else if constexpr(messageType == Warn) {
|
||||
fmt::print(fg(fmt::color::yellow), fmt, args...);
|
||||
} else if constexpr(messageType == Info) {
|
||||
@@ -24,10 +23,7 @@ constexpr void print(const std::string& fmt, Args... args) {
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
if constexpr(messageType == Error) {
|
||||
fmt::print(fmt, args...);
|
||||
exit(-1);
|
||||
} else if constexpr(messageType == Debug) {
|
||||
if constexpr(messageType == Debug) {
|
||||
#ifndef NDEBUG
|
||||
fmt::print(fmt, args...);
|
||||
#endif
|
||||
@@ -40,6 +36,7 @@ constexpr void print(const std::string& fmt, Args... args) {
|
||||
template <typename ...Args>
|
||||
constexpr void panic(const std::string& fmt, Args... args) {
|
||||
print<Error>(fmt, args...);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
template <typename ...Args>
|
||||
|
||||
Reference in New Issue
Block a user