authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-21 02:22:07-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-03-21 02:22:07-04:00
log827538b88f9b440454616ec497b5f303fa199e59
tree23fc0b623d4984b95ed8a3f864016d598bf244fd
parenta5dc3f03423befa5a2ec1efc07f9bf26eae1a3d9
parent65058ebd72d06ee5f920df3e2c3e68dd77f5fccf
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #11241 from jagt/master

add compiler_rt ceilf/ceil/ceill

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

lib/std/special/c.zig-19
......@@ -83,10 +83,6 @@ comptime {
8383 @export(log10, .{ .name = "log10", .linkage = .Strong });
8484 @export(log10f, .{ .name = "log10f", .linkage = .Strong });
8585
86 @export(ceil, .{ .name = "ceil", .linkage = .Strong });
87 @export(ceilf, .{ .name = "ceilf", .linkage = .Strong });
88 @export(ceill, .{ .name = "ceill", .linkage = .Strong });
89
9086 @export(fmod, .{ .name = "fmod", .linkage = .Strong });
9187 @export(fmodf, .{ .name = "fmodf", .linkage = .Strong });
9288
......@@ -429,21 +425,6 @@ fn log10f(a: f32) callconv(.C) f32 {
429425 return math.log10(a);
430426}
431427
432fn ceilf(x: f32) callconv(.C) f32 {
433 return math.ceil(x);
434}
435
436fn ceil(x: f64) callconv(.C) f64 {
437 return math.ceil(x);
438}
439
440fn ceill(x: c_longdouble) callconv(.C) c_longdouble {
441 if (!long_double_is_f128) {
442 @panic("TODO implement this");
443 }
444 return math.ceil(x);
445}
446
447428fn fmodf(x: f32, y: f32) callconv(.C) f32 {
448429 return generic_fmod(f32, x, y);
449430}
lib/std/special/compiler_rt.zig+17
......@@ -680,6 +680,10 @@ comptime {
680680 @export(floor, .{ .name = "floor", .linkage = linkage });
681681 @export(floorl, .{ .name = "floorl", .linkage = linkage });
682682
683 @export(ceilf, .{ .name = "ceilf", .linkage = linkage });
684 @export(ceil, .{ .name = "ceil", .linkage = linkage });
685 @export(ceill, .{ .name = "ceill", .linkage = linkage });
686
683687 @export(fma, .{ .name = "fma", .linkage = linkage });
684688 @export(fmaf, .{ .name = "fmaf", .linkage = linkage });
685689 @export(fmal, .{ .name = "fmal", .linkage = linkage });
......@@ -811,6 +815,19 @@ fn floorl(x: c_longdouble) callconv(.C) c_longdouble {
811815 return math.floor(x);
812816}
813817
818fn ceilf(x: f32) callconv(.C) f32 {
819 return math.ceil(x);
820}
821fn ceil(x: f64) callconv(.C) f64 {
822 return math.ceil(x);
823}
824fn ceill(x: c_longdouble) callconv(.C) c_longdouble {
825 if (!long_double_is_f128) {
826 @panic("TODO implement this");
827 }
828 return math.ceil(x);
829}
830
814831// Avoid dragging in the runtime safety mechanisms into this .o file,
815832// unless we're trying to test this file.
816833pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn {