| author | |
| committer | |
| log | 79d3780fbda475a50d6e0ca53d51c9e7c7690ab1 |
| tree | c500f3c426116267f37fdb0a567bb8de282fa199 |
| parent | 1af51a083383be5bbb3249c24e00326aff935122 |
2 files changed, 8 insertions(+), 0 deletions(-)
src/value.zig+5| ... | ... | @@ -2977,6 +2977,11 @@ pub const Value = extern union { |
| 2977 | 2977 | |
| 2978 | 2978 | const info = ty.intInfo(target); |
| 2979 | 2979 | |
| 2980 | if (info.bits == 0) { | |
| 2981 | assert(val.isZero()); // Sema should guarantee | |
| 2982 | return val; | |
| 2983 | } | |
| 2984 | ||
| 2980 | 2985 | // TODO is this a performance issue? maybe we should try the operation without |
| 2981 | 2986 | // resorting to BigInt first. |
| 2982 | 2987 | var val_space: Value.BigIntSpace = undefined; |
test/behavior/math.zig+3| ... | ... | @@ -375,6 +375,9 @@ test "binary not" { |
| 375 | 375 | try expect(comptime x: { |
| 376 | 376 | break :x ~@as(u64, 2147483647) == 18446744071562067968; |
| 377 | 377 | }); |
| 378 | try expect(comptime x: { | |
| 379 | break :x ~@as(u0, 0) == 0; | |
| 380 | }); | |
| 378 | 381 | try testBinaryNot(0b1010101010101010); |
| 379 | 382 | } |
| 380 | 383 |