aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/eval.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-12-21 16:40:30 +0200
committerVeikka Tuominen <git@vexu.eu>2022-12-27 15:13:14 +0200
commit622311fb9ac7ee6d93dcb8cda4b608751f7e092a (patch)
treeef54a9f6bc53919a4ef4f01aae2d9e3573aad871 /test/behavior/eval.zig
parent54160e7f6aecb4628df633ceaef4c6d956429a3d (diff)
downloadzig-622311fb9ac7ee6d93dcb8cda4b608751f7e092a.tar.gz
zig-622311fb9ac7ee6d93dcb8cda4b608751f7e092a.zip
update uses of overflow arithmetic builtins
Diffstat (limited to 'test/behavior/eval.zig')
-rw-r--r--test/behavior/eval.zig15
1 files changed, 4 insertions, 11 deletions
diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig
index 97c3a85bbb..8c3962e3e4 100644
--- a/test/behavior/eval.zig
+++ b/test/behavior/eval.zig
@@ -489,18 +489,11 @@ test "comptime bitwise operators" {
test "comptime shlWithOverflow" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
- const ct_shifted: u64 = comptime amt: {
- var amt = @as(u64, 0);
- _ = @shlWithOverflow(u64, ~@as(u64, 0), 16, &amt);
- break :amt amt;
- };
-
- const rt_shifted: u64 = amt: {
- var amt = @as(u64, 0);
- _ = @shlWithOverflow(u64, ~@as(u64, 0), 16, &amt);
- break :amt amt;
- };
+ const ct_shifted = @shlWithOverflow(~@as(u64, 0), 16)[0];
+ var a = ~@as(u64, 0);
+ const rt_shifted = @shlWithOverflow(a, 16)[0];
try expect(ct_shifted == rt_shifted);
}