hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 0ce7559b177ed06637eda6c7f9753e1c2be61c7b
parent ef5a7b6543faa88802c3f3206e6c4601ce59ca86
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); };