| ... | ... | @@ -630,11 +630,31 @@ comptime { |
| 630 | 630 | _ = @import("compiler_rt/atomics.zig"); |
| 631 | 631 | |
| 632 | 632 | @export(fmaq, .{ .name = "fmaq", .linkage = linkage }); |
| 633 | @export(floorf, .{ .name = "floorf", .linkage = linkage }); |
| 634 | @export(floor, .{ .name = "floor", .linkage = linkage }); |
| 635 | @export(floorl, .{ .name = "floorl", .linkage = linkage }); |
| 633 | 636 | } |
| 634 | 637 | } |
| 635 | 638 | |
| 639 | const math = std.math; |
| 640 | |
| 636 | 641 | fn fmaq(a: f128, b: f128, c: f128) callconv(.C) f128 { |
| 637 | | return std.math.fma(f128, a, b, c); |
| 642 | return math.fma(f128, a, b, c); |
| 643 | } |
| 644 | |
| 645 | // TODO add intrinsics for these (and probably the double version too) |
| 646 | // and have the math stuff use the intrinsic. same as @mod and @rem |
| 647 | fn floorf(x: f32) callconv(.C) f32 { |
| 648 | return math.floor(x); |
| 649 | } |
| 650 | fn floor(x: f64) callconv(.C) f64 { |
| 651 | return math.floor(x); |
| 652 | } |
| 653 | fn floorl(x: c_longdouble) callconv(.C) c_longdouble { |
| 654 | if (!long_double_is_f128) { |
| 655 | @panic("TODO implement this"); |
| 656 | } |
| 657 | return math.floor(x); |
| 638 | 658 | } |
| 639 | 659 | |
| 640 | 660 | // Avoid dragging in the runtime safety mechanisms into this .o file, |