store and load decimal numbers

This commit is contained in:
Folkert 2021-11-12 21:38:22 +01:00
parent acfe8fd015
commit 57538c5e94
2 changed files with 16 additions and 1 deletions

View file

@ -544,6 +544,21 @@ impl<'a> WasmBackend<'a> {
}
StoredValue::StackMemory { location, .. } => match lit {
Literal::Decimal(decimal) => {
let (local_id, offset) =
location.local_and_offset(self.storage.stack_frame_pointer);
let lower_bits = decimal.0 as i64;
let upper_bits = (decimal.0 >> 64) as i64;
self.code_builder.get_local(local_id);
self.code_builder.i64_const(lower_bits);
self.code_builder.i64_store(Align::Bytes8, offset);
self.code_builder.get_local(local_id);
self.code_builder.i64_const(upper_bits);
self.code_builder.i64_store(Align::Bytes8, offset + 8);
}
Literal::Str(string) => {
let (local_id, offset) =
location.local_and_offset(self.storage.stack_frame_pointer);