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 {
201
201
self . reg [ vx as usize ] = byte;
202
202
} ,
203
203
AddK ( vx, byte) => {
204
- self . reg [ vx as usize ] += byte;
204
+ self . reg [ vx as usize ] = self . reg [ vx as usize ] . wrapping_add ( byte) ;
205
205
} ,
206
206
Set ( vx, vy) => self . reg [ vx as usize ] = self . reg [ vy as usize ] ,
207
207
Or ( vx, vy) => self . reg [ vx as usize ] |= self . reg [ vy as usize ] ,
@@ -224,7 +224,7 @@ impl Vm {
224
224
// VF is Not Borrow i.e. x > y
225
225
self . reg [ Register :: VF as usize ] = ( x > y) as u8 ;
226
226
227
- self . reg [ vx as usize ] = x - y ;
227
+ self . reg [ vx as usize ] = x. wrapping_sub ( y ) ;
228
228
} ,
229
229
ShiftRight ( vx, vy) => {
230
230
let y = self . reg [ vy as usize ] ;
@@ -241,7 +241,7 @@ impl Vm {
241
241
// VF is Not Borrow i.e. y > x
242
242
self . reg [ Register :: VF as usize ] = ( y > x) as u8 ;
243
243
244
- self . reg [ vx as usize ] = y - x ;
244
+ self . reg [ vx as usize ] = y. wrapping_sub ( x ) ;
245
245
} ,
246
246
ShiftLeft ( vx, vy) => {
247
247
let y = self . reg [ vy as usize ] ;
You can’t perform that action at this time.
0 commit comments