From b714827f244cfbf1670e46cfca0a3fc2381fa147 Mon Sep 17 00:00:00 2001 From: Shautvast Date: Thu, 7 Dec 2023 15:27:30 +0100 Subject: [PATCH] bugfix increment needs to be i16 not u16 --- src/vm/runtime.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vm/runtime.rs b/src/vm/runtime.rs index 0dcb819..2772557 100644 --- a/src/vm/runtime.rs +++ b/src/vm/runtime.rs @@ -427,7 +427,7 @@ impl Stackframe { self.push(I32(compare(value1, value2))); } IINC(index8, const8) => { - self.increment(*index8 as usize, *const8 as u16); + self.increment(*index8 as usize, (*const8 as i8) as i16); } I2L => { let value = self.pop().into_i32() as i64; @@ -454,7 +454,7 @@ impl Stackframe { self.push(F64(value)); } WIDE_IINC(index16, const16) => { - self.increment(*index16 as usize, *const16); + self.increment(*index16 as usize, *const16 as i16); } F2I => { let value = self.pop().into_f32() as i32; @@ -878,7 +878,7 @@ impl Stackframe { Void } - fn increment(&mut self, index: usize, inc: u16) { + fn increment(&mut self, index: usize, inc: i16) { match &mut self.locals[index] { I32(l) => *l += (inc as i32), I64(l) => *l += (inc as i64),