| ... | ... | @@ -3,24 +3,11 @@ const clz = @import("count0bits.zig"); |
| 3 | 3 | const testing = @import("std").testing; |
| 4 | 4 | |
| 5 | 5 | fn test__clzsi2(a: u32, expected: i32) !void { |
| 6 | | // stage1 and stage2 diverge on function pointer semantics |
| 7 | | switch (builtin.zig_backend) { |
| 8 | | .stage1 => { |
| 9 | | // Use of `var` here is working around a stage1 bug. |
| 10 | | var nakedClzsi2 = clz.__clzsi2; |
| 11 | | var actualClzsi2 = @ptrCast(fn (a: i32) callconv(.C) i32, nakedClzsi2); |
| 12 | | var x = @bitCast(i32, a); |
| 13 | | var result = actualClzsi2(x); |
| 14 | | try testing.expectEqual(expected, result); |
| 15 | | }, |
| 16 | | else => { |
| 17 | | const nakedClzsi2 = clz.__clzsi2; |
| 18 | | const actualClzsi2 = @ptrCast(*const fn (a: i32) callconv(.C) i32, &nakedClzsi2); |
| 19 | | const x = @bitCast(i32, a); |
| 20 | | const result = actualClzsi2(x); |
| 21 | | try testing.expectEqual(expected, result); |
| 22 | | }, |
| 23 | | } |
| 6 | const nakedClzsi2 = clz.__clzsi2; |
| 7 | const actualClzsi2 = @ptrCast(*const fn (a: i32) callconv(.C) i32, &nakedClzsi2); |
| 8 | const x = @bitCast(i32, a); |
| 9 | const result = actualClzsi2(x); |
| 10 | try testing.expectEqual(expected, result); |
| 24 | 11 | } |
| 25 | 12 | |
| 26 | 13 | test "clzsi2" { |