mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
stage2: bit_not on u0 is always 0
This commit is contained in:
parent
1af51a0833
commit
79d3780fbd
@ -2977,6 +2977,11 @@ pub const Value = extern union {
|
||||
|
||||
const info = ty.intInfo(target);
|
||||
|
||||
if (info.bits == 0) {
|
||||
assert(val.isZero()); // Sema should guarantee
|
||||
return val;
|
||||
}
|
||||
|
||||
// TODO is this a performance issue? maybe we should try the operation without
|
||||
// resorting to BigInt first.
|
||||
var val_space: Value.BigIntSpace = undefined;
|
||||
|
||||
@ -375,6 +375,9 @@ test "binary not" {
|
||||
try expect(comptime x: {
|
||||
break :x ~@as(u64, 2147483647) == 18446744071562067968;
|
||||
});
|
||||
try expect(comptime x: {
|
||||
break :x ~@as(u0, 0) == 0;
|
||||
});
|
||||
try testBinaryNot(0b1010101010101010);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user