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

@ -78,26 +78,26 @@ comptime {
// Num Module
const num = @import("num.zig");
const INTEGERS = [_]type{ i8, i16, i32, i64, i128, u8, u16, u32, u64, u128, usize };
const INTEGERS = [_]type{ i8, i16, i32, i64, i128, u8, u16, u32, u64, u128 };
const FLOATS = [_]type{ f32, f64 };
const NUMBERS = INTEGERS ++ FLOATS;
comptime {
exportNumFn(num.divCeil, "div_ceil");
exportNumFn(num.bytesToU16C, "bytes_to_u16");
exportNumFn(num.bytesToU32C, "bytes_to_u32");
inline for (INTEGERS) |T| {
num.exportPow(T, ROC_BUILTINS ++ "." ++ NUM ++ ".pow_int_");
num.exportPow(T, ROC_BUILTINS ++ "." ++ NUM ++ ".pow_int.");
num.exportDivCeil(T, ROC_BUILTINS ++ "." ++ NUM ++ ".div_ceil.");
}
inline for (FLOATS) |T| {
num.exportAsin(T, ROC_BUILTINS ++ "." ++ NUM ++ ".acos_");
num.exportAcos(T, ROC_BUILTINS ++ "." ++ NUM ++ ".asin_");
num.exportAtan(T, ROC_BUILTINS ++ "." ++ NUM ++ ".atan_");
num.exportAsin(T, ROC_BUILTINS ++ "." ++ NUM ++ ".acos.");
num.exportAcos(T, ROC_BUILTINS ++ "." ++ NUM ++ ".asin.");
num.exportAtan(T, ROC_BUILTINS ++ "." ++ NUM ++ ".atan.");
num.exportIsFinite(T, ROC_BUILTINS ++ "." ++ NUM ++ ".is_finite_");
num.exportRound(T, ROC_BUILTINS ++ "." ++ NUM ++ ".round_");
num.exportIsFinite(T, ROC_BUILTINS ++ "." ++ NUM ++ ".is_finite.");
num.exportRound(T, ROC_BUILTINS ++ "." ++ NUM ++ ".round.");
}
}