| author | |
| committer | |
| log | 26fac15f485e89dc7106256e1aa79184c1761efd |
| tree | 59f0c3a453e0789f989bf096fe6fe235a6865b14 |
| parent | d019229c2c3432c9053594eb140b255c3be9ebeb |
2 files changed, 4 insertions(+), 4 deletions(-)
lib/std/math/big/int.zig+2-2| ... | ... | @@ -2512,7 +2512,7 @@ pub const Const = struct { |
| 2512 | 2512 | return total_limb_lz + bits - total_limb_bits; |
| 2513 | 2513 | } |
| 2514 | 2514 | |
| 2515 | pub fn ctz(a: Const) Limb { | |
| 2515 | pub fn ctz(a: Const, bits: Limb) Limb { | |
| 2516 | 2516 | // Limbs are stored in little-endian order. |
| 2517 | 2517 | var result: Limb = 0; |
| 2518 | 2518 | for (a.limbs) |limb| { |
| ... | ... | @@ -2520,7 +2520,7 @@ pub const Const = struct { |
| 2520 | 2520 | result += limb_tz; |
| 2521 | 2521 | if (limb_tz != @sizeOf(Limb) * 8) break; |
| 2522 | 2522 | } |
| 2523 | return result; | |
| 2523 | return @min(result, bits); | |
| 2524 | 2524 | } |
| 2525 | 2525 | }; |
| 2526 | 2526 |
src/value.zig+2-2| ... | ... | @@ -1216,10 +1216,10 @@ pub const Value = struct { |
| 1216 | 1216 | return bigint.clz(ty.intInfo(mod).bits); |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | pub fn ctz(val: Value, _: Type, mod: *Module) u64 { | |
| 1219 | pub fn ctz(val: Value, ty: Type, mod: *Module) u64 { | |
| 1220 | 1220 | var bigint_buf: BigIntSpace = undefined; |
| 1221 | 1221 | const bigint = val.toBigInt(&bigint_buf, mod); |
| 1222 | return bigint.ctz(); | |
| 1222 | return bigint.ctz(ty.intInfo(mod).bits); | |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | 1225 | pub fn popCount(val: Value, ty: Type, mod: *Module) u64 { |