Merge remote-tracking branch 'origin/main' into remove-nat

This commit is contained in:
Richard Feldman 2024-02-11 12:26:36 -05:00
commit 24a38c4a26
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
99 changed files with 2636 additions and 938 deletions

View file

@ -204,7 +204,6 @@ impl<'a> LowLevelCall<'a> {
StrCountUtf8Bytes => {
self.load_args_and_call_zig(backend, bitcode::STR_COUNT_UTF8_BYTES)
}
StrGetCapacity => self.load_args_and_call_zig(backend, bitcode::STR_CAPACITY),
StrToNum => {
let number_layout = match backend.layout_interner.get_repr(self.ret_layout) {
LayoutRepr::Struct(field_layouts) => field_layouts[0],
@ -1589,6 +1588,10 @@ impl<'a> LowLevelCall<'a> {
LayoutRepr::Builtin(Builtin::Float(width)) => {
self.load_args_and_call_zig(backend, &bitcode::NUM_POW[width]);
}
LayoutRepr::Builtin(Builtin::Decimal) => {
self.load_args_and_call_zig(backend, bitcode::DEC_POW);
}
_ => panic_ret_type(),
},

View file

@ -22,8 +22,21 @@ macro_rules! wasm32_sized_primitive {
}
}
wasm32_sized_primitive!(u8, i8, u16, i16, u32, i32, char, u64, i64, u128, i128, f32, f64, bool,);
wasm32_sized_primitive!(RocDec, RocOrder, I128, U128,);
wasm32_sized_primitive!(u8, i8, u16, i16, u32, i32, char, u64, i64, f32, f64, bool,);
wasm32_sized_primitive!(RocOrder,);
macro_rules! wasm32_16byte_aligned8 {
($($type_name:ident ,)+) => {
$(
impl Wasm32Sized for $type_name {
const SIZE_OF_WASM: usize = 16;
const ALIGN_OF_WASM: usize = 8;
}
)*
}
}
wasm32_16byte_aligned8!(i128, u128, I128, U128, RocDec,);
impl Wasm32Sized for () {
const SIZE_OF_WASM: usize = 0;