File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ impl Vm {
201201 self . reg [ vx as usize ] = byte;
202202 } ,
203203 AddK ( vx, byte) => {
204- self . reg [ vx as usize ] += byte;
204+ self . reg [ vx as usize ] = self . reg [ vx as usize ] . wrapping_add ( byte) ;
205205 } ,
206206 Set ( vx, vy) => self . reg [ vx as usize ] = self . reg [ vy as usize ] ,
207207 Or ( vx, vy) => self . reg [ vx as usize ] |= self . reg [ vy as usize ] ,
@@ -224,7 +224,7 @@ impl Vm {
224224 // VF is Not Borrow i.e. x > y
225225 self . reg [ Register :: VF as usize ] = ( x > y) as u8 ;
226226
227- self . reg [ vx as usize ] = x - y ;
227+ self . reg [ vx as usize ] = x. wrapping_sub ( y ) ;
228228 } ,
229229 ShiftRight ( vx, vy) => {
230230 let y = self . reg [ vy as usize ] ;
@@ -241,7 +241,7 @@ impl Vm {
241241 // VF is Not Borrow i.e. y > x
242242 self . reg [ Register :: VF as usize ] = ( y > x) as u8 ;
243243
244- self . reg [ vx as usize ] = y - x ;
244+ self . reg [ vx as usize ] = y. wrapping_sub ( x ) ;
245245 } ,
246246 ShiftLeft ( vx, vy) => {
247247 let y = self . reg [ vy as usize ] ;
You can’t perform that action at this time.
0 commit comments