harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit e4bb3330fdba3c5f6e0025072ed7babd8e7dffa4
parent ce632ca7fb51173bec8ef6c95dcbd3428b10b8c7
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Thu,  4 Feb 2021 18:00:08 -0500

rt: size2bin: fix assertion

The C equivalent is `if (s > bin2size(BINS - 1) return -1;`.

Diffstat:
Mrt/malloc.ha | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rt/malloc.ha b/rt/malloc.ha @@ -41,7 +41,7 @@ let bins: [50]nullable *void = [null...]; fn bin2size(b: size) size = ((b + 1z) * ALIGN - 1z) * WORD; fn size2bin(s: size) size = { - assert(s < bin2size(len(bins) - 1z), "Size exceeds maximum for bin"); + assert(s <= bin2size(len(bins) - 1z), "Size exceeds maximum for bin"); return (s + (WORD * (ALIGN - 1z) - 1z)) / (WORD * ALIGN); };