zig
zig copied to clipboard
`>>` gives incorrect result at comptime when x < 0 and shift > log2(x)
Zig Version
0.10.0-dev.4430+f39f0fcac
Steps to Reproduce
const std = @import("std");
const expect = std.testing.expect;
test {
var i: i8 = -3;
try expect(i >> 2 == @as(i8, -3) >> 2);
}
Expected Behavior
Test should pass.
Actual Behavior
Test fails.
what's the output if you use expectEqual ?
At comptime @as(i8, -3) >> 2) == 0 but at runtime i >> 2 == -1