diff --git a/include/platform_info.h b/include/platform_info.h index 310aa4d1f9..216179d3a7 100644 --- a/include/platform_info.h +++ b/include/platform_info.h @@ -10,6 +10,8 @@ #define IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) #endif -#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void *) / 4)) +// Using 8 here instead of sizeof(size_t) to ensure compatibility +#define SIZEOF_POINTER (size_t)8 +#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (SIZEOF_POINTER / 4)) #endif // PLATFORM_INFO_H diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index fbb73211c5..4ac077b9bb 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -159,8 +159,8 @@ void main_func(void) { WHBLogPrint("Exception handler initialized."); #endif - static u64 pool[0x165000/8 / 4 * sizeof(void *)]; - main_pool_init(pool, pool + sizeof(pool) / sizeof(pool[0])); + static u8 pool[DOUBLE_SIZE_ON_64_BIT(0x165000)] __attribute__ ((aligned(16))); + main_pool_init(pool, pool + sizeof(pool)); gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT); configfile_load(CONFIG_FILE);