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

This commit is contained in:
William Sengir 2022-03-20 00:29:44 -07:00 committed by Andrew Kelley
parent 2d8fef5680
commit 3f4676901a

View File

@ -3359,6 +3359,8 @@ pub const Value = extern union {
}
pub fn intTrunc(val: Value, allocator: Allocator, signedness: std.builtin.Signedness, bits: u16) !Value {
if (bits == 0) return Value.zero;
var val_space: Value.BigIntSpace = undefined;
const val_bigint = val.toBigInt(&val_space);