From a94267b2906e90aadf397b3f524e1069721fb496 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Tue, 22 Feb 2022 14:02:23 +0100 Subject: [PATCH] std: export ceil builtins in stage2 --- lib/std/special/c.zig | 19 +++++++++++++++++++ lib/std/special/c_stage1.zig | 13 ------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/std/special/c.zig b/lib/std/special/c.zig index 37c3c52604..56bbe28e0e 100644 --- a/lib/std/special/c.zig +++ b/lib/std/special/c.zig @@ -46,6 +46,10 @@ 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 }); } // Avoid dragging in the runtime safety mechanisms into this .o file, @@ -179,3 +183,18 @@ fn log10(a: f64) callconv(.C) f64 { 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); +} diff --git a/lib/std/special/c_stage1.zig b/lib/std/special/c_stage1.zig index 8541162293..7549c65d59 100644 --- a/lib/std/special/c_stage1.zig +++ b/lib/std/special/c_stage1.zig @@ -613,19 +613,6 @@ export fn fmod(x: f64, y: f64) f64 { return generic_fmod(f64, x, y); } -export fn ceilf(x: f32) f32 { - return math.ceil(x); -} -export fn ceil(x: f64) f64 { - return math.ceil(x); -} -export fn ceill(x: c_longdouble) c_longdouble { - if (!long_double_is_f128) { - @panic("TODO implement this"); - } - return math.ceil(x); -} - export fn fmaf(a: f32, b: f32, c: f32) f32 { return math.fma(f32, a, b, c); }