mirror of
https://github.com/ziglang/zig.git
synced 2025-12-28 00:53:18 +00:00
compiler_rt: remove stage1 switch case
This commit is contained in:
parent
20c5b6ad65
commit
41a7670a38
@ -3,24 +3,11 @@ const clz = @import("count0bits.zig");
|
||||
const testing = @import("std").testing;
|
||||
|
||||
fn test__clzsi2(a: u32, expected: i32) !void {
|
||||
// stage1 and stage2 diverge on function pointer semantics
|
||||
switch (builtin.zig_backend) {
|
||||
.stage1 => {
|
||||
// Use of `var` here is working around a stage1 bug.
|
||||
var nakedClzsi2 = clz.__clzsi2;
|
||||
var actualClzsi2 = @ptrCast(fn (a: i32) callconv(.C) i32, nakedClzsi2);
|
||||
var x = @bitCast(i32, a);
|
||||
var result = actualClzsi2(x);
|
||||
try testing.expectEqual(expected, result);
|
||||
},
|
||||
else => {
|
||||
const nakedClzsi2 = clz.__clzsi2;
|
||||
const actualClzsi2 = @ptrCast(*const fn (a: i32) callconv(.C) i32, &nakedClzsi2);
|
||||
const x = @bitCast(i32, a);
|
||||
const result = actualClzsi2(x);
|
||||
try testing.expectEqual(expected, result);
|
||||
},
|
||||
}
|
||||
const nakedClzsi2 = clz.__clzsi2;
|
||||
const actualClzsi2 = @ptrCast(*const fn (a: i32) callconv(.C) i32, &nakedClzsi2);
|
||||
const x = @bitCast(i32, a);
|
||||
const result = actualClzsi2(x);
|
||||
try testing.expectEqual(expected, result);
|
||||
}
|
||||
|
||||
test "clzsi2" {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user