From 2ca9220c1badad6b54240d907472b0fedc590eff Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 5 Dec 2023 16:25:33 +0100 Subject: Revert "fix undefined behavior: shift 32 bits for uint32_t in bf_set_ui" This reverts commit 821693c4374d9895f462fa29644905c61dbb241d. (Importing fix from upstream instead.) --- lib/quickjs/libbf.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/quickjs/libbf.c') diff --git a/lib/quickjs/libbf.c b/lib/quickjs/libbf.c index 63e7daeb..fe1628e7 100644 --- a/lib/quickjs/libbf.c +++ b/lib/quickjs/libbf.c @@ -235,13 +235,8 @@ int bf_set_ui(bf_t *r, uint64_t a) a0 = a; a1 = a >> 32; shift = clz(a1); - // shift < 32 because a > 0xffffffff r->tab[0] = a0 << shift; - if (shift == 0) { - r->tab[1] = a1; - } else { - r->tab[1] = (a1 << shift) | (a0 >> (LIMB_BITS - shift)); - } + r->tab[1] = (a1 << shift) | (a0 >> (LIMB_BITS - shift)); r->expn = 2 * LIMB_BITS - shift; } #endif -- cgit 1.4.1-2-gfad0