authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-02-22 14:02:23+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-02-22 21:56:34+01:00
loga94267b2906e90aadf397b3f524e1069721fb496
tree31f54464100cd932f634ca4e0fc852301a94279e
parent1bbb886694b96fdfbba0857dcba56a1ec5c8fbd4

std: export ceil builtins in stage2


2 files changed, 19 insertions(+), 13 deletions(-)

lib/std/special/c.zig+19
...@@ -46,6 +46,10 @@ comptime {...@@ -46,6 +46,10 @@ comptime {
4646
47 @export(log10, .{ .name = "log10", .linkage = .Strong });47 @export(log10, .{ .name = "log10", .linkage = .Strong });
48 @export(log10f, .{ .name = "log10f", .linkage = .Strong });48 @export(log10f, .{ .name = "log10f", .linkage = .Strong });
49
50 @export(ceil, .{ .name = "ceil", .linkage = .Strong });
51 @export(ceilf, .{ .name = "ceilf", .linkage = .Strong });
52 @export(ceill, .{ .name = "ceill", .linkage = .Strong });
49}53}
5054
51// Avoid dragging in the runtime safety mechanisms into this .o file,55// Avoid dragging in the runtime safety mechanisms into this .o file,
...@@ -179,3 +183,18 @@ fn log10(a: f64) callconv(.C) f64 {...@@ -179,3 +183,18 @@ fn log10(a: f64) callconv(.C) f64 {
179fn log10f(a: f32) callconv(.C) f32 {183fn log10f(a: f32) callconv(.C) f32 {
180 return math.log10(a);184 return math.log10(a);
181}185}
186
187fn ceilf(x: f32) callconv(.C) f32 {
188 return math.ceil(x);
189}
190
191fn ceil(x: f64) callconv(.C) f64 {
192 return math.ceil(x);
193}
194
195fn ceill(x: c_longdouble) callconv(.C) c_longdouble {
196 if (!long_double_is_f128) {
197 @panic("TODO implement this");
198 }
199 return math.ceil(x);
200}
lib/std/special/c_stage1.zig-13
...@@ -613,19 +613,6 @@ export fn fmod(x: f64, y: f64) f64 {...@@ -613,19 +613,6 @@ export fn fmod(x: f64, y: f64) f64 {
613 return generic_fmod(f64, x, y);613 return generic_fmod(f64, x, y);
614}614}
615615
616export fn ceilf(x: f32) f32 {
617 return math.ceil(x);
618}
619export fn ceil(x: f64) f64 {
620 return math.ceil(x);
621}
622export fn ceill(x: c_longdouble) c_longdouble {
623 if (!long_double_is_f128) {
624 @panic("TODO implement this");
625 }
626 return math.ceil(x);
627}
628
629export fn fmaf(a: f32, b: f32, c: f32) f32 {616export fn fmaf(a: f32, b: f32, c: f32) f32 {
630 return math.fma(f32, a, b, c);617 return math.fma(f32, a, b, c);
631}618}