hook up polymorphic zig builtins

This commit is contained in:
Folkert 2021-10-20 16:43:39 +02:00
parent ab34c2a55e
commit 63b1aaad4e
5 changed files with 114 additions and 94 deletions

View file

@ -57,8 +57,13 @@ pub fn exportRound(comptime T: type, comptime name: []const u8) void {
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });
}
pub fn divCeil(numerator: i64, denominator: i64) callconv(.C) i64 {
return @call(.{ .modifier = always_inline }, math.divCeil, .{ i64, numerator, denominator }) catch unreachable;
pub fn exportDivCeil(comptime T: type, comptime name: []const u8) void {
comptime var f = struct {
fn func(a: T, b: T) callconv(.C) T {
return math.divCeil(T, a, b) catch unreachable;
}
}.func;
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });
}
pub fn bytesToU16C(arg: RocList, position: usize) callconv(.C) u16 {