fix
This commit is contained in:
		
							parent
							
								
									b3d1380eba
								
							
						
					
					
						commit
						de2d98bfec
					
				@ -1,8 +1,9 @@
 | 
			
		||||
use crate::stack::StackVec;
 | 
			
		||||
use crate::{errors::RunError, stack::StackVec};
 | 
			
		||||
 | 
			
		||||
pub fn rjmp(memory: &mut StackVec, labels: &mut [Option<i16>; 256], program_counter: &mut u16) {
 | 
			
		||||
    let start = memory.pop() as usize;
 | 
			
		||||
    let end   = memory.pop() as usize;
 | 
			
		||||
    let rand  = fastrand::usize(start..end + 1);
 | 
			
		||||
 | 
			
		||||
    *program_counter = (labels[fastrand::usize(start..end)].unwrap() - 1) as u16;
 | 
			
		||||
    *program_counter = (labels[rand].expect(&format!("{}", RunError::UnknownLabel(rand as u16))) - 1) as u16;
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user