authorgravatar for william@sengir.comWilliam Sengir <william@sengir.com> 2022-03-20 00:29:44-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-21 16:54:19-07:00
log3f4676901a8c02d9d7069b284aa848d685c3975c
tree9c4e625363e0c68e4aaf43ab46f52432d111ecd6
parent2d8fef5680dc8218596e701f91d918c4aa7215bc

stage2: return `Value.zero` when truncating int to 0 bits at comptime


1 files changed, 2 insertions(+), 0 deletions(-)

src/value.zig+2
...@@ -3359,6 +3359,8 @@ pub const Value = extern union {...@@ -3359,6 +3359,8 @@ pub const Value = extern union {
3359 }3359 }
33603360
3361 pub fn intTrunc(val: Value, allocator: Allocator, signedness: std.builtin.Signedness, bits: u16) !Value {3361 pub fn intTrunc(val: Value, allocator: Allocator, signedness: std.builtin.Signedness, bits: u16) !Value {
3362 if (bits == 0) return Value.zero;
3363
3362 var val_space: Value.BigIntSpace = undefined;3364 var val_space: Value.BigIntSpace = undefined;
3363 const val_bigint = val.toBigInt(&val_space);3365 const val_bigint = val.toBigInt(&val_space);
33643366