bugfix increment needs to be i16 not u16

This commit is contained in:
Shautvast 2023-12-07 15:27:30 +01:00
parent a7d772c093
commit b714827f24

View file

@ -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),