diff options
Diffstat (limited to 'zone.h')
-rw-r--r-- | zone.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/zone.h b/zone.h index 0a6db89..936f757 100644 --- a/zone.h +++ b/zone.h @@ -72,8 +72,7 @@ char *zn_strdup(Zone *z, const char *s); if (cap < ZONE_MIN_CAPACITY) cap = ZONE_MIN_CAPACITY; size_t pg_size = sysconf(_SC_PAGE_SIZE) / sizeof(uintptr_t); size_t hdr_size = sizeof(ZoneFrame) / sizeof(uintptr_t); - cap += pg_size - (cap % pg_size); - return cap - hdr_size; + return cap + (-cap & (pg_size - 1)) - hdr_size; } #elif ZONE_BACKEND == ZONE_USE_MALLOC |