@@ -18,6 +18,7 @@ use crate::util::CHECK_MEM_STRICT;
18
18
pub use self :: sha3:: sha3_tests:: { gen_sha3_code, MemoryKind } ;
19
19
20
20
mod address;
21
+ mod arthmetic;
21
22
mod balance;
22
23
mod begin_end_tx;
23
24
mod blockhash;
@@ -78,6 +79,7 @@ pub use callop::tests::PrecompileCallArgs;
78
79
use self :: { pushn:: PushN , sha3:: Sha3 } ;
79
80
80
81
use address:: Address ;
82
+ use arthmetic:: ArithmeticOpcode ;
81
83
use balance:: Balance ;
82
84
use begin_end_tx:: BeginEndTx ;
83
85
use blockhash:: Blockhash ;
@@ -171,30 +173,32 @@ fn fn_gen_associated_ops(opcode_id: &OpcodeId) -> FnGenAssociatedOps {
171
173
match opcode_id {
172
174
OpcodeId :: PUSH0 => Push0 :: gen_associated_ops,
173
175
OpcodeId :: STOP => Stop :: gen_associated_ops,
174
- OpcodeId :: ADD => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
175
- OpcodeId :: MUL => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
176
- OpcodeId :: SUB => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
177
- OpcodeId :: DIV => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
178
- OpcodeId :: SDIV => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
179
- OpcodeId :: MOD => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
180
- OpcodeId :: SMOD => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
181
- OpcodeId :: ADDMOD => StackOnlyOpcode :: < 3 , 1 > :: gen_associated_ops,
182
- OpcodeId :: MULMOD => StackOnlyOpcode :: < 3 , 1 > :: gen_associated_ops,
183
- OpcodeId :: SIGNEXTEND => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
184
- OpcodeId :: LT => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
185
- OpcodeId :: GT => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
186
- OpcodeId :: SLT => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
187
- OpcodeId :: SGT => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
188
- OpcodeId :: EQ => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
189
- OpcodeId :: ISZERO => StackOnlyOpcode :: < 1 , 1 > :: gen_associated_ops,
190
- OpcodeId :: AND => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
191
- OpcodeId :: OR => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
192
- OpcodeId :: XOR => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
193
- OpcodeId :: NOT => StackOnlyOpcode :: < 1 , 1 > :: gen_associated_ops,
194
- OpcodeId :: BYTE => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
195
- OpcodeId :: SHL => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
196
- OpcodeId :: SHR => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
197
- OpcodeId :: SAR => StackOnlyOpcode :: < 2 , 1 > :: gen_associated_ops,
176
+ OpcodeId :: ADD => ArithmeticOpcode :: < { OpcodeId :: ADD . as_u8 ( ) } , 2 > :: gen_associated_ops,
177
+ OpcodeId :: MUL => ArithmeticOpcode :: < { OpcodeId :: MUL . as_u8 ( ) } , 2 > :: gen_associated_ops,
178
+ OpcodeId :: SUB => ArithmeticOpcode :: < { OpcodeId :: SUB . as_u8 ( ) } , 2 > :: gen_associated_ops,
179
+ OpcodeId :: DIV => ArithmeticOpcode :: < { OpcodeId :: DIV . as_u8 ( ) } , 2 > :: gen_associated_ops,
180
+ OpcodeId :: SDIV => ArithmeticOpcode :: < { OpcodeId :: SDIV . as_u8 ( ) } , 2 > :: gen_associated_ops,
181
+ OpcodeId :: MOD => ArithmeticOpcode :: < { OpcodeId :: MOD . as_u8 ( ) } , 2 > :: gen_associated_ops,
182
+ OpcodeId :: SMOD => ArithmeticOpcode :: < { OpcodeId :: SMOD . as_u8 ( ) } , 2 > :: gen_associated_ops,
183
+ OpcodeId :: ADDMOD => ArithmeticOpcode :: < { OpcodeId :: ADDMOD . as_u8 ( ) } , 3 > :: gen_associated_ops,
184
+ OpcodeId :: MULMOD => ArithmeticOpcode :: < { OpcodeId :: MULMOD . as_u8 ( ) } , 3 > :: gen_associated_ops,
185
+ OpcodeId :: SIGNEXTEND => {
186
+ ArithmeticOpcode :: < { OpcodeId :: SIGNEXTEND . as_u8 ( ) } , 2 > :: gen_associated_ops
187
+ }
188
+ OpcodeId :: LT => ArithmeticOpcode :: < { OpcodeId :: LT . as_u8 ( ) } , 2 > :: gen_associated_ops,
189
+ OpcodeId :: GT => ArithmeticOpcode :: < { OpcodeId :: GT . as_u8 ( ) } , 2 > :: gen_associated_ops,
190
+ OpcodeId :: SLT => ArithmeticOpcode :: < { OpcodeId :: SLT . as_u8 ( ) } , 2 > :: gen_associated_ops,
191
+ OpcodeId :: SGT => ArithmeticOpcode :: < { OpcodeId :: SGT . as_u8 ( ) } , 2 > :: gen_associated_ops,
192
+ OpcodeId :: EQ => ArithmeticOpcode :: < { OpcodeId :: EQ . as_u8 ( ) } , 2 > :: gen_associated_ops,
193
+ OpcodeId :: ISZERO => ArithmeticOpcode :: < { OpcodeId :: ISZERO . as_u8 ( ) } , 1 > :: gen_associated_ops,
194
+ OpcodeId :: AND => ArithmeticOpcode :: < { OpcodeId :: AND . as_u8 ( ) } , 2 > :: gen_associated_ops,
195
+ OpcodeId :: OR => ArithmeticOpcode :: < { OpcodeId :: OR . as_u8 ( ) } , 2 > :: gen_associated_ops,
196
+ OpcodeId :: XOR => ArithmeticOpcode :: < { OpcodeId :: XOR . as_u8 ( ) } , 2 > :: gen_associated_ops,
197
+ OpcodeId :: NOT => ArithmeticOpcode :: < { OpcodeId :: NOT . as_u8 ( ) } , 1 > :: gen_associated_ops,
198
+ OpcodeId :: BYTE => ArithmeticOpcode :: < { OpcodeId :: BYTE . as_u8 ( ) } , 2 > :: gen_associated_ops,
199
+ OpcodeId :: SHL => ArithmeticOpcode :: < { OpcodeId :: SHL . as_u8 ( ) } , 2 > :: gen_associated_ops,
200
+ OpcodeId :: SHR => ArithmeticOpcode :: < { OpcodeId :: SHR . as_u8 ( ) } , 2 > :: gen_associated_ops,
201
+ OpcodeId :: SAR => ArithmeticOpcode :: < { OpcodeId :: SAR . as_u8 ( ) } , 2 > :: gen_associated_ops,
198
202
OpcodeId :: SHA3 => Sha3 :: gen_associated_ops,
199
203
OpcodeId :: ADDRESS => Address :: gen_associated_ops,
200
204
OpcodeId :: BALANCE => Balance :: gen_associated_ops,
0 commit comments