Fix getMaxAllocatableSize & CMemBlock::getBlock on 64-bit

This commit is contained in:
PJB3005
2026-02-24 21:39:45 +01:00
parent 6e0c9f2637
commit 696cf75ed3
3 changed files with 17 additions and 3 deletions
+2 -2
View File
@@ -313,8 +313,8 @@ u8 JKRHeap::getCurrentGroupId() {
}
u32 JKRHeap::getMaxAllocatableSize(int alignment) {
u32 maxFreeBlock = (uintptr_t)getMaxFreeBlock();
u32 ptrOffset = (alignment - 1) & alignment - (maxFreeBlock & 0xf);
uintptr_t maxFreeBlock = (uintptr_t)getMaxFreeBlock();
uintptr_t ptrOffset = (alignment - 1) & alignment - (maxFreeBlock & (MEM_BLOCK_SIZE - 1));
return ~(alignment - 1) & (getFreeSize() - ptrOffset);
}