aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/int128.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-06-22 18:46:56 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-24 16:56:39 -0700
commitf26dda21171e26f44aeec8c59a75bbb3331eeb2e (patch)
treec935248861ae2693b314f2c8bc78fe38d9961b6d /test/behavior/int128.zig
parent447ca4e3fff021f471b748187b53f0a4744ad0bc (diff)
downloadzig-f26dda21171e26f44aeec8c59a75bbb3331eeb2e.tar.gz
zig-f26dda21171e26f44aeec8c59a75bbb3331eeb2e.zip
all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
Diffstat (limited to 'test/behavior/int128.zig')
-rw-r--r--test/behavior/int128.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/behavior/int128.zig b/test/behavior/int128.zig
index 6fd2c192a2..42f0b00922 100644
--- a/test/behavior/int128.zig
+++ b/test/behavior/int128.zig
@@ -38,7 +38,7 @@ test "undefined 128 bit int" {
var undef: u128 = undefined;
var undef_signed: i128 = undefined;
- try expect(undef == 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa and @bitCast(u128, undef_signed) == undef);
+ try expect(undef == 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa and @as(u128, @bitCast(undef_signed)) == undef);
}
test "int128" {
@@ -49,7 +49,7 @@ test "int128" {
var buff: i128 = -1;
try expect(buff < 0 and (buff + 1) == 0);
- try expect(@intCast(i8, buff) == @as(i8, -1));
+ try expect(@as(i8, @intCast(buff)) == @as(i8, -1));
buff = minInt(i128);
try expect(buff < 0);
@@ -73,16 +73,16 @@ test "truncate int128" {
{
var buff: u128 = maxInt(u128);
- try expect(@truncate(u64, buff) == maxInt(u64));
- try expect(@truncate(u90, buff) == maxInt(u90));
- try expect(@truncate(u128, buff) == maxInt(u128));
+ try expect(@as(u64, @truncate(buff)) == maxInt(u64));
+ try expect(@as(u90, @truncate(buff)) == maxInt(u90));
+ try expect(@as(u128, @truncate(buff)) == maxInt(u128));
}
{
var buff: i128 = maxInt(i128);
- try expect(@truncate(i64, buff) == -1);
- try expect(@truncate(i90, buff) == -1);
- try expect(@truncate(i128, buff) == maxInt(i128));
+ try expect(@as(i64, @truncate(buff)) == -1);
+ try expect(@as(i90, @truncate(buff)) == -1);
+ try expect(@as(i128, @truncate(buff)) == maxInt(i128));
}
}