Commit ac867cc45f
Changed files (1)
test
test/translate_c.zig
@@ -814,7 +814,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
\\}
, &[_][]const u8{
\\pub export fn foo() c_int {
- \\ return (@as(c_int, 1) << @as(@import("std").math.Log2Int(c_int), 2)) >> @as(@import("std").math.Log2Int(c_int), 1);
+ \\ return (@as(c_int, 1) << @intCast(@import("std").math.Log2Int(c_int), 2)) >> @intCast(@import("std").math.Log2Int(c_int), 1);
\\}
});
@@ -1980,7 +1980,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
\\ var a = arg_a;
\\ var i: c_int = 0;
\\ while (a > @bitCast(c_uint, @as(c_int, 0))) {
- \\ a >>= @as(@import("std").math.Log2Int(c_int), 1);
+ \\ a >>= @intCast(@import("std").math.Log2Int(c_int), 1);
\\ }
\\ return i;
\\}
@@ -2000,7 +2000,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
\\ var a = arg_a;
\\ var i: c_int = 0;
\\ while (a > @bitCast(c_uint, @as(c_int, 0))) {
- \\ a >>= @as(@import("std").math.Log2Int(c_int), 1);
+ \\ a >>= @intCast(@import("std").math.Log2Int(c_int), 1);
\\ }
\\ return i;
\\}
@@ -2051,14 +2051,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
\\ ref.* = ref.* ^ @as(c_int, 1);
\\ break :blk ref.*;
\\ });
- \\ a >>= @as(@import("std").math.Log2Int(c_int), (blk: {
+ \\ a >>= @intCast(@import("std").math.Log2Int(c_int), (blk: {
\\ const ref = &a;
- \\ ref.* = ref.* >> @as(@import("std").math.Log2Int(c_int), @as(c_int, 1));
+ \\ ref.* = ref.* >> @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1));
\\ break :blk ref.*;
\\ }));
- \\ a <<= @as(@import("std").math.Log2Int(c_int), (blk: {
+ \\ a <<= @intCast(@import("std").math.Log2Int(c_int), (blk: {
\\ const ref = &a;
- \\ ref.* = ref.* << @as(@import("std").math.Log2Int(c_int), @as(c_int, 1));
+ \\ ref.* = ref.* << @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1));
\\ break :blk ref.*;
\\ }));
\\}
@@ -2109,14 +2109,14 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
\\ ref.* = ref.* ^ @bitCast(c_uint, @as(c_int, 1));
\\ break :blk ref.*;
\\ });
- \\ a >>= @as(@import("std").math.Log2Int(c_uint), (blk: {
+ \\ a >>= @intCast(@import("std").math.Log2Int(c_uint), (blk: {
\\ const ref = &a;
- \\ ref.* = ref.* >> @as(@import("std").math.Log2Int(c_int), @as(c_int, 1));
+ \\ ref.* = ref.* >> @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1));
\\ break :blk ref.*;
\\ }));
- \\ a <<= @as(@import("std").math.Log2Int(c_uint), (blk: {
+ \\ a <<= @intCast(@import("std").math.Log2Int(c_uint), (blk: {
\\ const ref = &a;
- \\ ref.* = ref.* << @as(@import("std").math.Log2Int(c_int), @as(c_int, 1));
+ \\ ref.* = ref.* << @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1));
\\ break :blk ref.*;
\\ }));
\\}