2022-03-18 22:02:52 +00:00
|
|
|
const builtin = @import("builtin");
|
2022-01-09 16:49:27 +00:00
|
|
|
const std = @import("std");
|
|
|
|
const expect = std.testing.expect;
|
|
|
|
const maxInt = std.math.maxInt;
|
|
|
|
|
|
|
|
test "@intCast i32 to u7" {
|
2022-03-18 22:02:52 +00:00
|
|
|
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
|
|
|
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
|
|
|
|
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
|
|
|
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
2022-10-11 14:39:47 +01:00
|
|
|
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
2022-03-18 22:02:52 +00:00
|
|
|
|
2022-01-09 16:49:27 +00:00
|
|
|
var x: u128 = maxInt(u128);
|
|
|
|
var y: i32 = 120;
|
|
|
|
var z = x >> @intCast(u7, y);
|
|
|
|
try expect(z == 0xff);
|
|
|
|
}
|