std.math.big.int: normalize zero result for small multiplications

Resolves: #25221
This commit is contained in:
mlugg
2025-09-13 11:31:17 +01:00
committed by Alex Rønne Petersen
parent 05b7ca6356
commit 83a3365bfd
2 changed files with 10 additions and 4 deletions

View File

@@ -1325,3 +1325,10 @@ test "large enum field values" {
try expect(@intFromEnum(e) == std.math.maxInt(i128));
}
}
test "comptime @enumFromInt with signed arithmetic" {
const E = enum(i8) { foo = -1, bar = 0 };
const x: E = @enumFromInt(@as(i8, -1) * 0);
comptime assert(x == .bar);
comptime assert(@intFromEnum(x) == 0);
}