Commit 3f4676901a

William Sengir <william@sengir.com>
2022-03-20 08:29:44
stage2: return `Value.zero` when truncating int to 0 bits at comptime
1 parent 2d8fef5
Changed files (1)
src/value.zig
@@ -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);