From 26fac15f485e89dc7106256e1aa79184c1761efd Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Wed, 31 May 2023 00:42:24 -0400 Subject: math.big.int: fix ctz of zero --- src/value.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/value.zig b/src/value.zig index 89ba1fba67..62a83c7901 100644 --- a/src/value.zig +++ b/src/value.zig @@ -1216,10 +1216,10 @@ pub const Value = struct { return bigint.clz(ty.intInfo(mod).bits); } - pub fn ctz(val: Value, _: Type, mod: *Module) u64 { + pub fn ctz(val: Value, ty: Type, mod: *Module) u64 { var bigint_buf: BigIntSpace = undefined; const bigint = val.toBigInt(&bigint_buf, mod); - return bigint.ctz(); + return bigint.ctz(ty.intInfo(mod).bits); } pub fn popCount(val: Value, ty: Type, mod: *Module) u64 { -- cgit v1.2.3