mirror of
https://github.com/radareorg/quickjs.git
synced 2026-11-07 14:38:27 -10:00
Handle zero limb when counting leading zeroes (#1110)
I opted to take a more general approach than bellard/quickjs@638ec8c so this problem hopefully doesn't show up again in the future. Fixes: https://github.com/quickjs-ng/quickjs/issues/1105
This commit is contained in:
1 parent
3d3b58d881
commit
0191aea691
2 files changed
+4
No files matched your search
@@ -10617,6 +10617,8 @@ do { \
|
||||
/* a != 0 */
|
||||
static inline js_limb_t js_limb_clz(js_limb_t a)
|
||||
{
|
||||
if (!a)
|
||||
return JS_LIMB_BITS;
|
||||
return clz32(a);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ function test_bigint1()
|
||||
|
||||
r = 1n << 32n;
|
||||
assert(r, 4294967296n, "1 << 32n === 4294967296n");
|
||||
|
||||
assert(String(-9223372036854775808n), "-9223372036854775808");
|
||||
}
|
||||
|
||||
function test_bigint2()
|
||||
|
||||
Reference in new issue
Block a user