{
char* aligned =
(char*)(
- (size_t)(
+ (uintptr_t)(
zone->chunk_list.ptr + (MSGPACK_ZONE_ALIGN - 1)
- ) / MSGPACK_ZONE_ALIGN * MSGPACK_ZONE_ALIGN
+ ) & ~(uintptr_t)(MSGPACK_ZONE_ALIGN - 1)
);
size_t adjusted_size = size + (size_t)(aligned - zone->chunk_list.ptr);
if(zone->chunk_list.free >= adjusted_size) {
{
void* ptr = msgpack_zone_malloc_expand(zone, size + (MSGPACK_ZONE_ALIGN - 1));
if (ptr) {
- return (char*)((size_t)(ptr) / MSGPACK_ZONE_ALIGN * MSGPACK_ZONE_ALIGN);
+ return (char*)((uintptr_t)(ptr) & ~(uintptr_t)(MSGPACK_ZONE_ALIGN - 1));
}
}
return NULL;