Skip to content

Commit 496e814

Browse files
committed
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
1 parent a3def65 commit 496e814

File tree

647 files changed

+8919
-8993
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

647 files changed

+8919
-8993
lines changed

lib/compiler_rt/addf3.zig

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@ pub inline fn addf3(comptime T: type, a: T, b: T) T {
2424
const significandMask = (@as(Z, 1) << significandBits) - 1;
2525

2626
const absMask = signBit - 1;
27-
const qnanRep = @bitCast(Z, math.nan(T)) | quietBit;
27+
const qnanRep = @as(Z, @bitCast(math.nan(T))) | quietBit;
2828

29-
var aRep = @bitCast(Z, a);
30-
var bRep = @bitCast(Z, b);
29+
var aRep = @as(Z, @bitCast(a));
30+
var bRep = @as(Z, @bitCast(b));
3131
const aAbs = aRep & absMask;
3232
const bAbs = bRep & absMask;
3333

34-
const infRep = @bitCast(Z, math.inf(T));
34+
const infRep = @as(Z, @bitCast(math.inf(T)));
3535

3636
// Detect if a or b is zero, infinity, or NaN.
3737
if (aAbs -% @as(Z, 1) >= infRep - @as(Z, 1) or
3838
bAbs -% @as(Z, 1) >= infRep - @as(Z, 1))
3939
{
4040
// NaN + anything = qNaN
41-
if (aAbs > infRep) return @bitCast(T, @bitCast(Z, a) | quietBit);
41+
if (aAbs > infRep) return @as(T, @bitCast(@as(Z, @bitCast(a)) | quietBit));
4242
// anything + NaN = qNaN
43-
if (bAbs > infRep) return @bitCast(T, @bitCast(Z, b) | quietBit);
43+
if (bAbs > infRep) return @as(T, @bitCast(@as(Z, @bitCast(b)) | quietBit));
4444

4545
if (aAbs == infRep) {
4646
// +/-infinity + -/+infinity = qNaN
47-
if ((@bitCast(Z, a) ^ @bitCast(Z, b)) == signBit) {
48-
return @bitCast(T, qnanRep);
47+
if ((@as(Z, @bitCast(a)) ^ @as(Z, @bitCast(b))) == signBit) {
48+
return @as(T, @bitCast(qnanRep));
4949
}
5050
// +/-infinity + anything remaining = +/- infinity
5151
else {
@@ -60,7 +60,7 @@ pub inline fn addf3(comptime T: type, a: T, b: T) T {
6060
if (aAbs == 0) {
6161
// but we need to get the sign right for zero + zero
6262
if (bAbs == 0) {
63-
return @bitCast(T, @bitCast(Z, a) & @bitCast(Z, b));
63+
return @as(T, @bitCast(@as(Z, @bitCast(a)) & @as(Z, @bitCast(b))));
6464
} else {
6565
return b;
6666
}
@@ -78,8 +78,8 @@ pub inline fn addf3(comptime T: type, a: T, b: T) T {
7878
}
7979

8080
// Extract the exponent and significand from the (possibly swapped) a and b.
81-
var aExponent = @intCast(i32, (aRep >> significandBits) & maxExponent);
82-
var bExponent = @intCast(i32, (bRep >> significandBits) & maxExponent);
81+
var aExponent = @as(i32, @intCast((aRep >> significandBits) & maxExponent));
82+
var bExponent = @as(i32, @intCast((bRep >> significandBits) & maxExponent));
8383
var aSignificand = aRep & significandMask;
8484
var bSignificand = bRep & significandMask;
8585

@@ -101,25 +101,25 @@ pub inline fn addf3(comptime T: type, a: T, b: T) T {
101101

102102
// Shift the significand of b by the difference in exponents, with a sticky
103103
// bottom bit to get rounding correct.
104-
const @"align" = @intCast(u32, aExponent - bExponent);
104+
const @"align" = @as(u32, @intCast(aExponent - bExponent));
105105
if (@"align" != 0) {
106106
if (@"align" < typeWidth) {
107-
const sticky = if (bSignificand << @intCast(S, typeWidth - @"align") != 0) @as(Z, 1) else 0;
108-
bSignificand = (bSignificand >> @truncate(S, @"align")) | sticky;
107+
const sticky = if (bSignificand << @as(S, @intCast(typeWidth - @"align")) != 0) @as(Z, 1) else 0;
108+
bSignificand = (bSignificand >> @as(S, @truncate(@"align"))) | sticky;
109109
} else {
110110
bSignificand = 1; // sticky; b is known to be non-zero.
111111
}
112112
}
113113
if (subtraction) {
114114
aSignificand -= bSignificand;
115115
// If a == -b, return +zero.
116-
if (aSignificand == 0) return @bitCast(T, @as(Z, 0));
116+
if (aSignificand == 0) return @as(T, @bitCast(@as(Z, 0)));
117117

118118
// If partial cancellation occured, we need to left-shift the result
119119
// and adjust the exponent:
120120
if (aSignificand < integerBit << 3) {
121-
const shift = @intCast(i32, @clz(aSignificand)) - @intCast(i32, @clz(integerBit << 3));
122-
aSignificand <<= @intCast(S, shift);
121+
const shift = @as(i32, @intCast(@clz(aSignificand))) - @as(i32, @intCast(@clz(integerBit << 3)));
122+
aSignificand <<= @as(S, @intCast(shift));
123123
aExponent -= shift;
124124
}
125125
} else { // addition
@@ -135,13 +135,13 @@ pub inline fn addf3(comptime T: type, a: T, b: T) T {
135135
}
136136

137137
// If we have overflowed the type, return +/- infinity:
138-
if (aExponent >= maxExponent) return @bitCast(T, infRep | resultSign);
138+
if (aExponent >= maxExponent) return @as(T, @bitCast(infRep | resultSign));
139139

140140
if (aExponent <= 0) {
141141
// Result is denormal; the exponent and round/sticky bits are zero.
142142
// All we need to do is shift the significand and apply the correct sign.
143-
aSignificand >>= @intCast(S, 4 - aExponent);
144-
return @bitCast(T, resultSign | aSignificand);
143+
aSignificand >>= @as(S, @intCast(4 - aExponent));
144+
return @as(T, @bitCast(resultSign | aSignificand));
145145
}
146146

147147
// Low three bits are round, guard, and sticky.
@@ -151,7 +151,7 @@ pub inline fn addf3(comptime T: type, a: T, b: T) T {
151151
var result = (aSignificand >> 3) & significandMask;
152152

153153
// Insert the exponent and sign.
154-
result |= @intCast(Z, aExponent) << significandBits;
154+
result |= @as(Z, @intCast(aExponent)) << significandBits;
155155
result |= resultSign;
156156

157157
// Final rounding. The result may overflow to infinity, but that is the
@@ -164,7 +164,7 @@ pub inline fn addf3(comptime T: type, a: T, b: T) T {
164164
if ((result >> significandBits) != 0) result |= integerBit;
165165
}
166166

167-
return @bitCast(T, result);
167+
return @as(T, @bitCast(result));
168168
}
169169

170170
test {

lib/compiler_rt/addf3_test.zig

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
const std = @import("std");
77
const math = std.math;
8-
const qnan128 = @bitCast(f128, @as(u128, 0x7fff800000000000) << 64);
8+
const qnan128 = @as(f128, @bitCast(@as(u128, 0x7fff800000000000) << 64));
99

1010
const __addtf3 = @import("addtf3.zig").__addtf3;
1111
const __addxf3 = @import("addxf3.zig").__addxf3;
@@ -14,9 +14,9 @@ const __subtf3 = @import("subtf3.zig").__subtf3;
1414
fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
1515
const x = __addtf3(a, b);
1616

17-
const rep = @bitCast(u128, x);
18-
const hi = @intCast(u64, rep >> 64);
19-
const lo = @truncate(u64, rep);
17+
const rep = @as(u128, @bitCast(x));
18+
const hi = @as(u64, @intCast(rep >> 64));
19+
const lo = @as(u64, @truncate(rep));
2020

2121
if (hi == expected_hi and lo == expected_lo) {
2222
return;
@@ -37,7 +37,7 @@ test "addtf3" {
3737
try test__addtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
3838

3939
// NaN + any = NaN
40-
try test__addtf3(@bitCast(f128, (@as(u128, 0x7fff000000000000) << 64) | @as(u128, 0x800030000000)), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
40+
try test__addtf3(@as(f128, @bitCast((@as(u128, 0x7fff000000000000) << 64) | @as(u128, 0x800030000000))), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
4141

4242
// inf + inf = inf
4343
try test__addtf3(math.inf(f128), math.inf(f128), 0x7fff000000000000, 0x0);
@@ -53,9 +53,9 @@ test "addtf3" {
5353
fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void {
5454
const x = __subtf3(a, b);
5555

56-
const rep = @bitCast(u128, x);
57-
const hi = @intCast(u64, rep >> 64);
58-
const lo = @truncate(u64, rep);
56+
const rep = @as(u128, @bitCast(x));
57+
const hi = @as(u64, @intCast(rep >> 64));
58+
const lo = @as(u64, @truncate(rep));
5959

6060
if (hi == expected_hi and lo == expected_lo) {
6161
return;
@@ -77,7 +77,7 @@ test "subtf3" {
7777
try test__subtf3(qnan128, 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
7878

7979
// NaN + any = NaN
80-
try test__subtf3(@bitCast(f128, (@as(u128, 0x7fff000000000000) << 64) | @as(u128, 0x800030000000)), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
80+
try test__subtf3(@as(f128, @bitCast((@as(u128, 0x7fff000000000000) << 64) | @as(u128, 0x800030000000))), 0x1.23456789abcdefp+5, 0x7fff800000000000, 0x0);
8181

8282
// inf - any = inf
8383
try test__subtf3(math.inf(f128), 0x1.23456789abcdefp+5, 0x7fff000000000000, 0x0);
@@ -87,50 +87,50 @@ test "subtf3" {
8787
try test__subtf3(0x1.ee9d7c52354a6936ab8d7654321fp-1, 0x1.234567829a3bcdef5678ade36734p+5, 0xc0041b8af1915166, 0xa44a7bca780a166c);
8888
}
8989

90-
const qnan80 = @bitCast(f80, @bitCast(u80, math.nan(f80)) | (1 << (math.floatFractionalBits(f80) - 1)));
90+
const qnan80 = @as(f80, @bitCast(@as(u80, @bitCast(math.nan(f80))) | (1 << (math.floatFractionalBits(f80) - 1))));
9191

9292
fn test__addxf3(a: f80, b: f80, expected: u80) !void {
9393
const x = __addxf3(a, b);
94-
const rep = @bitCast(u80, x);
94+
const rep = @as(u80, @bitCast(x));
9595

9696
if (rep == expected)
9797
return;
9898

99-
if (math.isNan(@bitCast(f80, expected)) and math.isNan(x))
99+
if (math.isNan(@as(f80, @bitCast(expected))) and math.isNan(x))
100100
return; // We don't currently test NaN payload propagation
101101

102102
return error.TestFailed;
103103
}
104104

105105
test "addxf3" {
106106
// NaN + any = NaN
107-
try test__addxf3(qnan80, 0x1.23456789abcdefp+5, @bitCast(u80, qnan80));
108-
try test__addxf3(@bitCast(f80, @as(u80, 0x7fff_8000_8000_3000_0000)), 0x1.23456789abcdefp+5, @bitCast(u80, qnan80));
107+
try test__addxf3(qnan80, 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
108+
try test__addxf3(@as(f80, @bitCast(@as(u80, 0x7fff_8000_8000_3000_0000))), 0x1.23456789abcdefp+5, @as(u80, @bitCast(qnan80)));
109109

110110
// any + NaN = NaN
111-
try test__addxf3(0x1.23456789abcdefp+5, qnan80, @bitCast(u80, qnan80));
112-
try test__addxf3(0x1.23456789abcdefp+5, @bitCast(f80, @as(u80, 0x7fff_8000_8000_3000_0000)), @bitCast(u80, qnan80));
111+
try test__addxf3(0x1.23456789abcdefp+5, qnan80, @as(u80, @bitCast(qnan80)));
112+
try test__addxf3(0x1.23456789abcdefp+5, @as(f80, @bitCast(@as(u80, 0x7fff_8000_8000_3000_0000))), @as(u80, @bitCast(qnan80)));
113113

114114
// NaN + inf = NaN
115-
try test__addxf3(qnan80, math.inf(f80), @bitCast(u80, qnan80));
115+
try test__addxf3(qnan80, math.inf(f80), @as(u80, @bitCast(qnan80)));
116116

117117
// inf + NaN = NaN
118-
try test__addxf3(math.inf(f80), qnan80, @bitCast(u80, qnan80));
118+
try test__addxf3(math.inf(f80), qnan80, @as(u80, @bitCast(qnan80)));
119119

120120
// inf + inf = inf
121-
try test__addxf3(math.inf(f80), math.inf(f80), @bitCast(u80, math.inf(f80)));
121+
try test__addxf3(math.inf(f80), math.inf(f80), @as(u80, @bitCast(math.inf(f80))));
122122

123123
// inf + -inf = NaN
124-
try test__addxf3(math.inf(f80), -math.inf(f80), @bitCast(u80, qnan80));
124+
try test__addxf3(math.inf(f80), -math.inf(f80), @as(u80, @bitCast(qnan80)));
125125

126126
// -inf + inf = NaN
127-
try test__addxf3(-math.inf(f80), math.inf(f80), @bitCast(u80, qnan80));
127+
try test__addxf3(-math.inf(f80), math.inf(f80), @as(u80, @bitCast(qnan80)));
128128

129129
// inf + any = inf
130-
try test__addxf3(math.inf(f80), 0x1.2335653452436234723489432abcdefp+5, @bitCast(u80, math.inf(f80)));
130+
try test__addxf3(math.inf(f80), 0x1.2335653452436234723489432abcdefp+5, @as(u80, @bitCast(math.inf(f80))));
131131

132132
// any + inf = inf
133-
try test__addxf3(0x1.2335653452436234723489432abcdefp+5, math.inf(f80), @bitCast(u80, math.inf(f80)));
133+
try test__addxf3(0x1.2335653452436234723489432abcdefp+5, math.inf(f80), @as(u80, @bitCast(math.inf(f80))));
134134

135135
// any + any
136136
try test__addxf3(0x1.23456789abcdp+5, 0x1.dcba987654321p+5, 0x4005_BFFFFFFFFFFFC400);

lib/compiler_rt/arm.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,6 @@ pub fn __aeabi_ldivmod() callconv(.Naked) void {
192192
}
193193

194194
pub fn __aeabi_drsub(a: f64, b: f64) callconv(.AAPCS) f64 {
195-
const neg_a = @bitCast(f64, @bitCast(u64, a) ^ (@as(u64, 1) << 63));
195+
const neg_a = @as(f64, @bitCast(@as(u64, @bitCast(a)) ^ (@as(u64, 1) << 63)));
196196
return b + neg_a;
197197
}

lib/compiler_rt/atomics.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,16 @@ fn wideUpdate(comptime T: type, ptr: *T, val: T, update: anytype) T {
232232

233233
const addr = @intFromPtr(ptr);
234234
const wide_addr = addr & ~(@as(T, smallest_atomic_fetch_exch_size) - 1);
235-
const wide_ptr = @alignCast(smallest_atomic_fetch_exch_size, @ptrFromInt(*WideAtomic, wide_addr));
235+
const wide_ptr: *align(smallest_atomic_fetch_exch_size) WideAtomic = @alignCast(@as(*WideAtomic, @ptrFromInt(wide_addr)));
236236

237237
const inner_offset = addr & (@as(T, smallest_atomic_fetch_exch_size) - 1);
238-
const inner_shift = @intCast(std.math.Log2Int(T), inner_offset * 8);
238+
const inner_shift = @as(std.math.Log2Int(T), @intCast(inner_offset * 8));
239239

240240
const mask = @as(WideAtomic, std.math.maxInt(T)) << inner_shift;
241241

242242
var wide_old = @atomicLoad(WideAtomic, wide_ptr, .SeqCst);
243243
while (true) {
244-
const old = @truncate(T, (wide_old & mask) >> inner_shift);
244+
const old = @as(T, @truncate((wide_old & mask) >> inner_shift));
245245
const new = update(val, old);
246246
const wide_new = wide_old & ~mask | (@as(WideAtomic, new) << inner_shift);
247247
if (@cmpxchgWeak(WideAtomic, wide_ptr, wide_old, wide_new, .SeqCst, .SeqCst)) |new_wide_old| {

lib/compiler_rt/aulldiv.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pub fn _alldiv(a: i64, b: i64) callconv(.Stdcall) i64 {
2121
const an = (a ^ s_a) -% s_a;
2222
const bn = (b ^ s_b) -% s_b;
2323

24-
const r = @bitCast(u64, an) / @bitCast(u64, bn);
24+
const r = @as(u64, @bitCast(an)) / @as(u64, @bitCast(bn));
2525
const s = s_a ^ s_b;
26-
return (@bitCast(i64, r) ^ s) -% s;
26+
return (@as(i64, @bitCast(r)) ^ s) -% s;
2727
}
2828

2929
pub fn _aulldiv() callconv(.Naked) void {

lib/compiler_rt/aullrem.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pub fn _allrem(a: i64, b: i64) callconv(.Stdcall) i64 {
2121
const an = (a ^ s_a) -% s_a;
2222
const bn = (b ^ s_b) -% s_b;
2323

24-
const r = @bitCast(u64, an) % @bitCast(u64, bn);
24+
const r = @as(u64, @bitCast(an)) % @as(u64, @bitCast(bn));
2525
const s = s_a ^ s_b;
26-
return (@bitCast(i64, r) ^ s) -% s;
26+
return (@as(i64, @bitCast(r)) ^ s) -% s;
2727
}
2828

2929
pub fn _aullrem() callconv(.Naked) void {

lib/compiler_rt/ceil.zig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ comptime {
2727

2828
pub fn __ceilh(x: f16) callconv(.C) f16 {
2929
// TODO: more efficient implementation
30-
return @floatCast(f16, ceilf(x));
30+
return @as(f16, @floatCast(ceilf(x)));
3131
}
3232

3333
pub fn ceilf(x: f32) callconv(.C) f32 {
34-
var u = @bitCast(u32, x);
35-
var e = @intCast(i32, (u >> 23) & 0xFF) - 0x7F;
34+
var u = @as(u32, @bitCast(x));
35+
var e = @as(i32, @intCast((u >> 23) & 0xFF)) - 0x7F;
3636
var m: u32 = undefined;
3737

3838
// TODO: Shouldn't need this explicit check.
@@ -43,7 +43,7 @@ pub fn ceilf(x: f32) callconv(.C) f32 {
4343
if (e >= 23) {
4444
return x;
4545
} else if (e >= 0) {
46-
m = @as(u32, 0x007FFFFF) >> @intCast(u5, e);
46+
m = @as(u32, 0x007FFFFF) >> @as(u5, @intCast(e));
4747
if (u & m == 0) {
4848
return x;
4949
}
@@ -52,7 +52,7 @@ pub fn ceilf(x: f32) callconv(.C) f32 {
5252
u += m;
5353
}
5454
u &= ~m;
55-
return @bitCast(f32, u);
55+
return @as(f32, @bitCast(u));
5656
} else {
5757
math.doNotOptimizeAway(x + 0x1.0p120);
5858
if (u >> 31 != 0) {
@@ -66,7 +66,7 @@ pub fn ceilf(x: f32) callconv(.C) f32 {
6666
pub fn ceil(x: f64) callconv(.C) f64 {
6767
const f64_toint = 1.0 / math.floatEps(f64);
6868

69-
const u = @bitCast(u64, x);
69+
const u = @as(u64, @bitCast(x));
7070
const e = (u >> 52) & 0x7FF;
7171
var y: f64 = undefined;
7272

@@ -96,13 +96,13 @@ pub fn ceil(x: f64) callconv(.C) f64 {
9696

9797
pub fn __ceilx(x: f80) callconv(.C) f80 {
9898
// TODO: more efficient implementation
99-
return @floatCast(f80, ceilq(x));
99+
return @as(f80, @floatCast(ceilq(x)));
100100
}
101101

102102
pub fn ceilq(x: f128) callconv(.C) f128 {
103103
const f128_toint = 1.0 / math.floatEps(f128);
104104

105-
const u = @bitCast(u128, x);
105+
const u = @as(u128, @bitCast(x));
106106
const e = (u >> 112) & 0x7FFF;
107107
var y: f128 = undefined;
108108

lib/compiler_rt/clear_cache.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn clear_cache(start: usize, end: usize) callconv(.C) void {
102102
// If CTR_EL0.IDC is set, data cache cleaning to the point of unification
103103
// is not required for instruction to data coherence.
104104
if (((ctr_el0 >> 28) & 0x1) == 0x0) {
105-
const dcache_line_size: usize = @as(usize, 4) << @intCast(u6, (ctr_el0 >> 16) & 15);
105+
const dcache_line_size: usize = @as(usize, 4) << @as(u6, @intCast((ctr_el0 >> 16) & 15));
106106
addr = start & ~(dcache_line_size - 1);
107107
while (addr < end) : (addr += dcache_line_size) {
108108
asm volatile ("dc cvau, %[addr]"
@@ -115,7 +115,7 @@ fn clear_cache(start: usize, end: usize) callconv(.C) void {
115115
// If CTR_EL0.DIC is set, instruction cache invalidation to the point of
116116
// unification is not required for instruction to data coherence.
117117
if (((ctr_el0 >> 29) & 0x1) == 0x0) {
118-
const icache_line_size: usize = @as(usize, 4) << @intCast(u6, (ctr_el0 >> 0) & 15);
118+
const icache_line_size: usize = @as(usize, 4) << @as(u6, @intCast((ctr_el0 >> 0) & 15));
119119
addr = start & ~(icache_line_size - 1);
120120
while (addr < end) : (addr += icache_line_size) {
121121
asm volatile ("ic ivau, %[addr]"

lib/compiler_rt/clzdi2_test.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const clz = @import("count0bits.zig");
22
const testing = @import("std").testing;
33

44
fn test__clzdi2(a: u64, expected: i64) !void {
5-
var x = @bitCast(i64, a);
5+
var x = @as(i64, @bitCast(a));
66
var result = clz.__clzdi2(x);
77
try testing.expectEqual(expected, result);
88
}

lib/compiler_rt/clzsi2_test.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const testing = @import("std").testing;
44

55
fn test__clzsi2(a: u32, expected: i32) !void {
66
const nakedClzsi2 = clz.__clzsi2;
7-
const actualClzsi2 = @ptrCast(*const fn (a: i32) callconv(.C) i32, &nakedClzsi2);
8-
const x = @bitCast(i32, a);
7+
const actualClzsi2 = @as(*const fn (a: i32) callconv(.C) i32, @ptrCast(&nakedClzsi2));
8+
const x = @as(i32, @bitCast(a));
99
const result = actualClzsi2(x);
1010
try testing.expectEqual(expected, result);
1111
}

0 commit comments

Comments
 (0)