User-defined literals

This commit is contained in:
wheremyfoodat 2023-07-27 15:09:52 +03:00 committed by georgemoralis
parent 441471370e
commit c0c6024e2c
3 changed files with 9 additions and 3 deletions

View File

@ -3,7 +3,7 @@
// constants // constants
constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = (5637144576); // ~ 6GB constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 5376_MB; // ~ 6GB
//memory types //memory types
constexpr int SCE_KERNEL_WB_ONION = 0; // write - back mode (Onion bus) constexpr int SCE_KERNEL_WB_ONION = 0; // write - back mode (Onion bus)

View File

@ -7,7 +7,7 @@ namespace HLE::Libs::LibKernel::MemoryManagement {
bool isPowerOfTwo(u64 n) { return std::popcount(n) == 1; } bool isPowerOfTwo(u64 n) { return std::popcount(n) == 1; }
bool is16KBmultiply(u64 n) { return ((n % (static_cast<u64>(16) * 1024) == 0)); } bool is16KBAligned(u64 n) { return ((n % (static_cast<u64>(16) * 1024) == 0)); }
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() { return SCE_KERNEL_MAIN_DMEM_SIZE; } u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() { return SCE_KERNEL_MAIN_DMEM_SIZE; }

View File

@ -13,4 +13,10 @@ using u64 = unsigned long long;
using f32 = float; using f32 = float;
using f64 = double; using f64 = double;
#define PS4_SYSV_ABI __attribute__((sysv_abi)) #define PS4_SYSV_ABI __attribute__((sysv_abi))
// UDLs for memory size values
constexpr u64 operator""_KB(u64 x) { return 1024ULL * x; }
constexpr u64 operator""_MB(u64 x) { return 1024_KB * x; }
constexpr u64 operator""_GB(u64 x) { return 1024_MB * x; }