Skip to content

Commit 036ead7

Browse files
JonaZz747liketechnik
authored andcommitted
fix(executor/pc-counter): set as isize
1 parent d349a01 commit 036ead7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/executor/program_counter.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ impl ProgramCounter {
4040
Ok(())
4141
}
4242

43-
pub fn previous(&mut self, offset: usize) -> Result<(), ProgramCounterError> {
43+
pub fn previous(
44+
&mut self,
45+
offset: usize,
46+
) -> Result<(), ProgramCounterError> {
4447
if offset > self.current_op_code {
4548
return Err(ProgramCounterError::OutOfBoundsError {
4649
actual_len: self.current_op_codes.len(),
47-
requested_pos: (self.current_op_code as isize) - (offset as isize),
50+
requested_pos: (self.current_op_code as isize)
51+
- (offset as isize),
4852
});
4953
}
5054
self.current_op_code -= offset;
@@ -56,7 +60,7 @@ impl ProgramCounter {
5660
if self.current_op_codes.len() <= position {
5761
return Err(ProgramCounterError::OutOfBoundsError {
5862
actual_len: self.current_op_codes.len(),
59-
requested_pos: position,
63+
requested_pos: position as isize,
6064
});
6165
}
6266
self.current_op_code = position;

0 commit comments

Comments
 (0)