aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler_rt/cos.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-06-22 18:46:56 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-24 16:56:39 -0700
commitf26dda21171e26f44aeec8c59a75bbb3331eeb2e (patch)
treec935248861ae2693b314f2c8bc78fe38d9961b6d /lib/compiler_rt/cos.zig
parent447ca4e3fff021f471b748187b53f0a4744ad0bc (diff)
downloadzig-f26dda21171e26f44aeec8c59a75bbb3331eeb2e.tar.gz
zig-f26dda21171e26f44aeec8c59a75bbb3331eeb2e.zip
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
Diffstat (limited to 'lib/compiler_rt/cos.zig')
-rw-r--r--lib/compiler_rt/cos.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/compiler_rt/cos.zig b/lib/compiler_rt/cos.zig
index 029b6c346a..898c4fa64e 100644
--- a/lib/compiler_rt/cos.zig
+++ b/lib/compiler_rt/cos.zig
@@ -25,7 +25,7 @@ comptime {
pub fn __cosh(a: f16) callconv(.C) f16 {
// TODO: more efficient implementation
- return @floatCast(f16, cosf(a));
+ return @as(f16, @floatCast(cosf(a)));
}
pub fn cosf(x: f32) callconv(.C) f32 {
@@ -35,7 +35,7 @@ pub fn cosf(x: f32) callconv(.C) f32 {
const c3pio2: f64 = 3.0 * math.pi / 2.0; // 0x4012D97C, 0x7F3321D2
const c4pio2: f64 = 4.0 * math.pi / 2.0; // 0x401921FB, 0x54442D18
- var ix = @bitCast(u32, x);
+ var ix = @as(u32, @bitCast(x));
const sign = ix >> 31 != 0;
ix &= 0x7fffffff;
@@ -86,7 +86,7 @@ pub fn cosf(x: f32) callconv(.C) f32 {
}
pub fn cos(x: f64) callconv(.C) f64 {
- var ix = @bitCast(u64, x) >> 32;
+ var ix = @as(u64, @bitCast(x)) >> 32;
ix &= 0x7fffffff;
// |x| ~< pi/4
@@ -116,12 +116,12 @@ pub fn cos(x: f64) callconv(.C) f64 {
pub fn __cosx(a: f80) callconv(.C) f80 {
// TODO: more efficient implementation
- return @floatCast(f80, cosq(a));
+ return @as(f80, @floatCast(cosq(a)));
}
pub fn cosq(a: f128) callconv(.C) f128 {
// TODO: more correct implementation
- return cos(@floatCast(f64, a));
+ return cos(@as(f64, @floatCast(a)));
}
pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble {