mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
fix most dev backend tests
This commit is contained in:
parent
5ca3d3bcf1
commit
89472bf495
7 changed files with 120 additions and 53 deletions
|
@ -1125,6 +1125,23 @@ pub fn fromF64C(arg: f64) callconv(.C) i128 {
|
|||
return if (@call(.{ .modifier = always_inline }, RocDec.fromF64, .{arg})) |dec| dec.num else @panic("TODO runtime exception failing convert f64 to RocDec");
|
||||
}
|
||||
|
||||
pub fn exportFromInt(comptime T: type, comptime name: []const u8) void {
|
||||
comptime var f = struct {
|
||||
fn func(self: T) callconv(.C) i128 {
|
||||
const this = @intCast(i128, self);
|
||||
|
||||
var result: i128 = undefined;
|
||||
|
||||
if (@mulWithOverflow(i128, this, RocDec.one_point_zero_i128, &result)) {
|
||||
@panic("TODO runtime exception failing convert integer to RocDec");
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}.func;
|
||||
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });
|
||||
}
|
||||
|
||||
pub fn fromU64C(arg: u64) callconv(.C) i128 {
|
||||
return @call(.{ .modifier = always_inline }, RocDec.fromU64, .{arg}).toI128();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue