Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable sign ext proposal support #4

Merged
merged 17 commits into from
Sep 9, 2024
Prev Previous commit
Next Next commit
simplify implementation
Maciej Wójcik committed Aug 23, 2024
commit 2439c71a6bf948ba49ece87b949975e269450610
6 changes: 3 additions & 3 deletions src/runner.rs
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ use crate::{
};
use alloc::{boxed::Box, vec::Vec};
use casper_wasm::elements::Local;
use casper_wasmi_core::SignExtendFrom;
use core::{fmt, ops, u32, usize};
use validation::{DEFAULT_MEMORY_INDEX, DEFAULT_TABLE_INDEX};

@@ -1273,12 +1274,11 @@ impl Interpreter {
fn run_iextend<T, U>(&mut self) -> Result<InstructionOutcome, TrapCode>
where
ValueInternal: From<U>,
U: WrapInto<T> + FromValueInternal,
T: ExtendInto<U>,
U: SignExtendFrom<T> + FromValueInternal,
{
let v = self.value_stack.pop_as::<U>();

let v = v.wrap_into().extend_into();
let v = v.sign_extend_from();
self.value_stack.push(v.into())?;

Ok(InstructionOutcome::RunNextInstruction)