@@ -1092,27 +1092,19 @@ where
1092
1092
}
1093
1093
1094
1094
fn do_binary_maths( & self , context: & mut MethodContext , op: OpInFlight ) -> Result <( ) , AmlError > {
1095
- let [ Argument :: Object ( left) , Argument :: Object ( right) , Argument :: Object ( target) ] = & op. arguments [ 0 ..2 ]
1096
- else {
1097
- Err ( AmlError :: InvalidOperationOnObject ) ?
1098
- } ;
1099
- let target2 = if op. op == Opcode :: Divide {
1100
- let Argument :: Object ( target2) = & op. arguments [ 3 ] else { panic ! ( ) } ;
1101
- Some ( target2)
1102
- } else {
1103
- None
1104
- } ;
1095
+ let [ Argument :: Object ( left) , Argument :: Object ( right) , target] = & op. arguments [ 0 ..3 ] else { panic ! ( ) } ;
1096
+ let target2 = if op. op == Opcode :: Divide { Some ( & op. arguments [ 3 ] ) } else { None } ;
1105
1097
1106
1098
let left = left. clone ( ) . unwrap_transparent_reference ( ) . as_integer ( ) ?;
1107
1099
let right = right. clone ( ) . unwrap_transparent_reference ( ) . as_integer ( ) ?;
1108
1100
1109
- let value = match op. op {
1101
+ let result = match op. op {
1110
1102
Opcode :: Add => left. wrapping_add ( right) ,
1111
1103
Opcode :: Subtract => left. wrapping_sub ( right) ,
1112
1104
Opcode :: Multiply => left. wrapping_mul ( right) ,
1113
1105
Opcode :: Divide => {
1114
1106
if let Some ( remainder) = target2 {
1115
- * remainder . gain_mut ( ) = Object :: Integer ( left. wrapping_rem ( right) ) ;
1107
+ self . do_store ( context , remainder , Arc :: new ( Object :: Integer ( left. wrapping_rem ( right) ) ) ) ? ;
1116
1108
}
1117
1109
left. wrapping_div_euclid ( right)
1118
1110
}
@@ -1127,8 +1119,9 @@ where
1127
1119
_ => panic ! ( ) ,
1128
1120
} ;
1129
1121
1130
- * target. gain_mut ( ) = Object :: Integer ( value) ;
1131
- context. contribute_arg ( Argument :: Object ( Arc :: new ( Object :: Integer ( value) ) ) ) ;
1122
+ let result = Arc :: new ( Object :: Integer ( result) ) ;
1123
+ self . do_store ( context, target, result. clone ( ) ) ?;
1124
+ context. contribute_arg ( Argument :: Object ( result) ) ;
1132
1125
Ok ( ( ) )
1133
1126
}
1134
1127
0 commit comments