mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 22:33:08 +00:00
compiler_rt: export floorf, floor, and floorl
This fixes a stage1 linker error when compiling with VS2022 on Windows.
This commit is contained in:
parent
12140ead43
commit
939f51aebb
@ -639,21 +639,6 @@ export fn fmod(x: f64, y: f64) f64 {
|
|||||||
return generic_fmod(f64, x, y);
|
return generic_fmod(f64, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add intrinsics for these (and probably the double version too)
|
|
||||||
// and have the math stuff use the intrinsic. same as @mod and @rem
|
|
||||||
export fn floorf(x: f32) f32 {
|
|
||||||
return math.floor(x);
|
|
||||||
}
|
|
||||||
export fn floor(x: f64) f64 {
|
|
||||||
return math.floor(x);
|
|
||||||
}
|
|
||||||
export fn floorl(x: c_longdouble) c_longdouble {
|
|
||||||
if (!long_double_is_f128) {
|
|
||||||
@panic("TODO implement this");
|
|
||||||
}
|
|
||||||
return math.floor(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
export fn ceilf(x: f32) f32 {
|
export fn ceilf(x: f32) f32 {
|
||||||
return math.ceil(x);
|
return math.ceil(x);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -630,11 +630,31 @@ comptime {
|
|||||||
_ = @import("compiler_rt/atomics.zig");
|
_ = @import("compiler_rt/atomics.zig");
|
||||||
|
|
||||||
@export(fmaq, .{ .name = "fmaq", .linkage = linkage });
|
@export(fmaq, .{ .name = "fmaq", .linkage = linkage });
|
||||||
|
@export(floorf, .{ .name = "floorf", .linkage = linkage });
|
||||||
|
@export(floor, .{ .name = "floor", .linkage = linkage });
|
||||||
|
@export(floorl, .{ .name = "floorl", .linkage = linkage });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const math = std.math;
|
||||||
|
|
||||||
fn fmaq(a: f128, b: f128, c: f128) callconv(.C) f128 {
|
fn fmaq(a: f128, b: f128, c: f128) callconv(.C) f128 {
|
||||||
return std.math.fma(f128, a, b, c);
|
return math.fma(f128, a, b, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO add intrinsics for these (and probably the double version too)
|
||||||
|
// and have the math stuff use the intrinsic. same as @mod and @rem
|
||||||
|
fn floorf(x: f32) callconv(.C) f32 {
|
||||||
|
return math.floor(x);
|
||||||
|
}
|
||||||
|
fn floor(x: f64) callconv(.C) f64 {
|
||||||
|
return math.floor(x);
|
||||||
|
}
|
||||||
|
fn floorl(x: c_longdouble) callconv(.C) c_longdouble {
|
||||||
|
if (!long_double_is_f128) {
|
||||||
|
@panic("TODO implement this");
|
||||||
|
}
|
||||||
|
return math.floor(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid dragging in the runtime safety mechanisms into this .o file,
|
// Avoid dragging in the runtime safety mechanisms into this .o file,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user