From b7f40451844caa81f8ecb233c68777f06232d94c Mon Sep 17 00:00:00 2001 From: jagt Date: Sun, 20 Mar 2022 20:52:43 +0800 Subject: [PATCH 1/2] add compiler_rt ceilf/ceil/ceill this should fix stage1 build error with msvc 2019 --- lib/std/special/compiler_rt.zig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index 3941918c47..a017266304 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -680,6 +680,10 @@ comptime { @export(floor, .{ .name = "floor", .linkage = linkage }); @export(floorl, .{ .name = "floorl", .linkage = linkage }); + @export(ceilf, .{ .name = "ceilf", .linkage = linkage }); + @export(ceil, .{ .name = "ceil", .linkage = linkage }); + @export(ceill, .{ .name = "ceill", .linkage = linkage }); + @export(fma, .{ .name = "fma", .linkage = linkage }); @export(fmaf, .{ .name = "fmaf", .linkage = linkage }); @export(fmal, .{ .name = "fmal", .linkage = linkage }); @@ -811,6 +815,19 @@ fn floorl(x: c_longdouble) callconv(.C) c_longdouble { return math.floor(x); } +fn ceilf(x: f32) callconv(.C) f32 { + return math.ceil(x); +} +fn ceil(x: f64) callconv(.C) f64 { + return math.ceil(x); +} +fn ceill(x: c_longdouble) callconv(.C) c_longdouble { + if (!long_double_is_f128) { + @panic("TODO implement this"); + } + return math.ceil(x); +} + // Avoid dragging in the runtime safety mechanisms into this .o file, // unless we're trying to test this file. pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { From 65058ebd72d06ee5f920df3e2c3e68dd77f5fccf Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 20 Mar 2022 13:29:48 -0700 Subject: [PATCH 2/2] freestanding libc: remove ceil functions Now that they are in compiler-rt, they can be removed from here. --- lib/std/special/c.zig | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/lib/std/special/c.zig b/lib/std/special/c.zig index 326ca3a8a0..d0639463a0 100644 --- a/lib/std/special/c.zig +++ b/lib/std/special/c.zig @@ -83,10 +83,6 @@ comptime { @export(log10, .{ .name = "log10", .linkage = .Strong }); @export(log10f, .{ .name = "log10f", .linkage = .Strong }); - @export(ceil, .{ .name = "ceil", .linkage = .Strong }); - @export(ceilf, .{ .name = "ceilf", .linkage = .Strong }); - @export(ceill, .{ .name = "ceill", .linkage = .Strong }); - @export(fmod, .{ .name = "fmod", .linkage = .Strong }); @export(fmodf, .{ .name = "fmodf", .linkage = .Strong }); @@ -429,21 +425,6 @@ fn log10f(a: f32) callconv(.C) f32 { return math.log10(a); } -fn ceilf(x: f32) callconv(.C) f32 { - return math.ceil(x); -} - -fn ceil(x: f64) callconv(.C) f64 { - return math.ceil(x); -} - -fn ceill(x: c_longdouble) callconv(.C) c_longdouble { - if (!long_double_is_f128) { - @panic("TODO implement this"); - } - return math.ceil(x); -} - fn fmodf(x: f32, y: f32) callconv(.C) f32 { return generic_fmod(f32, x, y); }