mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-01 10:52:18 +00:00
make llvm tests work again
This commit is contained in:
parent
59af059912
commit
5ca3d3bcf1
13 changed files with 244 additions and 132 deletions
|
@ -1125,6 +1125,10 @@ 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 fromU64C(arg: u64) callconv(.C) i128 {
|
||||
return @call(.{ .modifier = always_inline }, RocDec.fromU64, .{arg}).toI128();
|
||||
}
|
||||
|
||||
pub fn toI128(arg: RocDec) callconv(.C) i128 {
|
||||
return @call(.{ .modifier = always_inline }, RocDec.toI128, .{arg});
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ comptime {
|
|||
exportDecFn(dec.fromStr, "from_str");
|
||||
exportDecFn(dec.toStr, "to_str");
|
||||
exportDecFn(dec.fromF64C, "from_f64");
|
||||
exportDecFn(dec.fromU64C, "from_u64");
|
||||
exportDecFn(dec.toI128, "to_i128");
|
||||
exportDecFn(dec.eqC, "eq");
|
||||
exportDecFn(dec.neqC, "neq");
|
||||
|
@ -82,6 +83,19 @@ comptime {
|
|||
exportNumFn(num.shiftRightZeroFillI128, "shift_right_zero_fill.i128");
|
||||
exportNumFn(num.shiftRightZeroFillU128, "shift_right_zero_fill.u128");
|
||||
|
||||
exportNumFn(num.compareI128, "compare.i128");
|
||||
exportNumFn(num.compareU128, "compare.u128");
|
||||
|
||||
exportNumFn(num.lessThanI128, "less_than.i128");
|
||||
exportNumFn(num.lessThanOrEqualI128, "less_than_or_equal.i128");
|
||||
exportNumFn(num.greaterThanI128, "greater_than.i128");
|
||||
exportNumFn(num.greaterThanOrEqualI128, "greater_than_or_equal.i128");
|
||||
|
||||
exportNumFn(num.lessThanU128, "less_than.u128");
|
||||
exportNumFn(num.lessThanOrEqualU128, "less_than_or_equal.u128");
|
||||
exportNumFn(num.greaterThanU128, "greater_than.u128");
|
||||
exportNumFn(num.greaterThanOrEqualU128, "greater_than_or_equal.u128");
|
||||
|
||||
inline for (INTEGERS) |T, i| {
|
||||
num.exportPow(T, ROC_BUILTINS ++ "." ++ NUM ++ ".pow_int.");
|
||||
num.exportDivCeil(T, ROC_BUILTINS ++ "." ++ NUM ++ ".div_ceil.");
|
||||
|
|
|
@ -4,6 +4,7 @@ const math = std.math;
|
|||
const RocList = @import("list.zig").RocList;
|
||||
const RocStr = @import("str.zig").RocStr;
|
||||
const WithOverflow = @import("utils.zig").WithOverflow;
|
||||
const Ordering = @import("utils.zig").Ordering;
|
||||
const roc_panic = @import("panic.zig").panic_help;
|
||||
|
||||
pub fn NumParseResult(comptime T: type) type {
|
||||
|
@ -558,6 +559,58 @@ pub fn shiftRightZeroFillU128(self: u128, other: u8) callconv(.C) u128 {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn compareI128(self: i128, other: i128) callconv(.C) Ordering {
|
||||
if (self == other) {
|
||||
return Ordering.EQ;
|
||||
} else if (self < other) {
|
||||
return Ordering.LT;
|
||||
} else {
|
||||
return Ordering.GT;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compareU128(self: u128, other: u128) callconv(.C) Ordering {
|
||||
if (self == other) {
|
||||
return Ordering.EQ;
|
||||
} else if (self < other) {
|
||||
return Ordering.LT;
|
||||
} else {
|
||||
return Ordering.GT;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn lessThanI128(self: i128, other: i128) callconv(.C) bool {
|
||||
return self < other;
|
||||
}
|
||||
|
||||
pub fn lessThanOrEqualI128(self: i128, other: i128) callconv(.C) bool {
|
||||
return self <= other;
|
||||
}
|
||||
|
||||
pub fn greaterThanI128(self: i128, other: i128) callconv(.C) bool {
|
||||
return self > other;
|
||||
}
|
||||
|
||||
pub fn greaterThanOrEqualI128(self: i128, other: i128) callconv(.C) bool {
|
||||
return self >= other;
|
||||
}
|
||||
|
||||
pub fn lessThanU128(self: u128, other: u128) callconv(.C) bool {
|
||||
return self < other;
|
||||
}
|
||||
|
||||
pub fn lessThanOrEqualU128(self: u128, other: u128) callconv(.C) bool {
|
||||
return self <= other;
|
||||
}
|
||||
|
||||
pub fn greaterThanU128(self: u128, other: u128) callconv(.C) bool {
|
||||
return self > other;
|
||||
}
|
||||
|
||||
pub fn greaterThanOrEqualU128(self: u128, other: u128) callconv(.C) bool {
|
||||
return self >= other;
|
||||
}
|
||||
|
||||
pub fn exportMulOrPanic(comptime T: type, comptime W: type, comptime name: []const u8) void {
|
||||
comptime var f = struct {
|
||||
fn func(self: T, other: T) callconv(.C) T {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue