From 89c1b39c6d978837dbe8a4937064274e210844f0 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 11 Oct 2022 21:59:40 -0400 Subject: [PATCH] =?UTF-8?q?Don't=20allow=200=20as=20a=20width=20for=20?= =?UTF-8?q?=E2=80=A2bit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sysfn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index 419a9017..d23dae96 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -1187,7 +1187,8 @@ B bitcast_im(Md1D* d, B x) { B f = d->f; } static usz req2(usz s, char* name) { - if (s & (s-1)) thrF("•bit._%U: sizes in 𝕗 must be powers of 2 (contained %s)", name, s); + usz top = 1ull << (8*sizeof(usz)-1); // Prevent 0 from passing + if ((top|s) & (s-1)) thrF("•bit._%U: sizes in 𝕗 must be powers of 2 (contained %s)", name, s); return s; }