From c524485c46c9be8a105dcf768bebd85939479589 Mon Sep 17 00:00:00 2001 From: Nic Barker Date: Tue, 17 Jun 2025 13:07:56 +1000 Subject: [PATCH] [Core] Fix case where there could be 64 extra bytes of padding between arrays in clays internal arena --- clay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clay.h b/clay.h index 3d53a9f..88f979f 100644 --- a/clay.h +++ b/clay.h @@ -3819,7 +3819,7 @@ Clay__Warning *Clay__WarningArray_Add(Clay__WarningArray *array, Clay__Warning i void* Clay__Array_Allocate_Arena(int32_t capacity, uint32_t itemSize, Clay_Arena *arena) { size_t totalSizeBytes = capacity * itemSize; - uintptr_t nextAllocOffset = arena->nextAllocation + (64 - (arena->nextAllocation % 64)); + uintptr_t nextAllocOffset = arena->nextAllocation + ((64 - (arena->nextAllocation % 64)) & 63); if (nextAllocOffset + totalSizeBytes <= arena->capacity) { arena->nextAllocation = nextAllocOffset + totalSizeBytes; return (void*)((uintptr_t)arena->memory + (uintptr_t)nextAllocOffset);