bundle compiler-rt through zig

This commit is contained in:
Brendan Hansknecht 2023-12-08 13:36:04 -08:00
parent f738d5a2bf
commit be06599bb6
No known key found for this signature in database
GPG key ID: A199D0660F95F948
4 changed files with 8 additions and 8 deletions

View file

@ -6,10 +6,10 @@ const expect = @import("expect.zig");
const panic_utils = @import("panic.zig");
const dbg_utils = @import("dbg.zig");
comptime {
_ = @import("compiler_rt.zig");
_ = @import("libc.zig");
}
// comptime {
// _ = @import("compiler_rt.zig");
// _ = @import("libc.zig");
// }
const ROC_BUILTINS = "roc_builtins";
const NUM = "num";

View file

@ -215,9 +215,7 @@ pub fn exportRound(comptime F: type, comptime T: type, comptime name: []const u8
pub fn exportFloor(comptime F: type, comptime T: type, comptime name: []const u8) void {
comptime var f = struct {
fn func(input: F) callconv(.C) T {
// intFromFloat just returns the integer part of the float.
// This means it automatically floors. No need for an explicit call to floor.
return @as(T, @intFromFloat(input));
return @as(T, @intFromFloat((math.floor(input))));
}
}.func;
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });