mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
hook up polymorphic zig builtins
This commit is contained in:
parent
ab34c2a55e
commit
63b1aaad4e
5 changed files with 114 additions and 94 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue