diff options
author | WormHeamer | 2025-02-28 21:27:25 -0500 |
---|---|---|
committer | WormHeamer | 2025-02-28 21:27:25 -0500 |
commit | 9c4420e3ef42a553ded82286988d3cf5d6570ca0 (patch) | |
tree | 38217272370d73a34776755403d81e8cb3cca043 | |
parent | 7f796680b3302646ec3e9a14ea673c2313f41895 (diff) |
use & intead of % when calculating mmap capacity
-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 |