Evaluate a constant expression that's either a i32 or a i64 as a global or a const instruction
(
&self,
const_instrs: &[tinywasm_types::ConstInstruction],
module_global_addrs: &[Addr],
module_func_addrs: &[FuncAddr],
)
| 523 | |
| 524 | /// Evaluate a constant expression that's either a i32 or a i64 as a global or a const instruction |
| 525 | fn eval_size_const( |
| 526 | &self, |
| 527 | const_instrs: &[tinywasm_types::ConstInstruction], |
| 528 | module_global_addrs: &[Addr], |
| 529 | module_func_addrs: &[FuncAddr], |
| 530 | ) -> Result<i64> { |
| 531 | let value = self.eval_const(const_instrs, module_global_addrs, module_func_addrs)?; |
| 532 | match value { |
| 533 | TinyWasmValue::Value32(i) => Ok(i64::from(i)), |
| 534 | TinyWasmValue::Value64(i) => Ok(i as i64), |
| 535 | other => Err(Error::Other(format!("expected i32 or i64, got {other:?}"))), |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | /// Evaluate a constant expression |
| 540 | fn eval_const( |
no test coverage detected