From 99edb5ab2b652413264244f344c7b889201d9ca0 Mon Sep 17 00:00:00 2001 From: CUB3D Date: Wed, 7 Apr 2021 18:19:50 +0100 Subject: [PATCH] avm2: Implement Op::Sxi1 --- core/src/avm2/activation.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/avm2/activation.rs b/core/src/avm2/activation.rs index 25c5d35ce..95bf553be 100644 --- a/core/src/avm2/activation.rs +++ b/core/src/avm2/activation.rs @@ -706,6 +706,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> { Op::Li32 => self.op_li32(), Op::Lf32 => self.op_lf32(), Op::Lf64 => self.op_lf64(), + Op::Sxi1 => self.op_sxi1(), _ => self.unknown_op(op), }; @@ -2700,6 +2701,19 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> { Ok(FrameControl::Continue) } + /// Implements `Op::Sxi1` + fn op_sxi1(&mut self) -> Result, Error> { + let val = self.context.avm2.pop().coerce_to_i32(self)?; + + let val = val.wrapping_shl(31).wrapping_shr(31); + + self.context + .avm2 + .push(Value::Integer(val)); + + Ok(FrameControl::Continue) + } + #[allow(unused_variables)] #[cfg(avm_debug)] fn op_debug(