mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
store and load decimal numbers
This commit is contained in:
parent
acfe8fd015
commit
57538c5e94
2 changed files with 16 additions and 1 deletions
|
@ -544,6 +544,21 @@ impl<'a> WasmBackend<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
StoredValue::StackMemory { location, .. } => match lit {
|
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) => {
|
Literal::Str(string) => {
|
||||||
let (local_id, offset) =
|
let (local_id, offset) =
|
||||||
location.local_and_offset(self.storage.stack_frame_pointer);
|
location.local_and_offset(self.storage.stack_frame_pointer);
|
||||||
|
|
|
@ -358,7 +358,7 @@ fn u8_hex_int_alias() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
fn dec_float_alias() {
|
fn dec_float_alias() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue