@@ -18,7 +18,7 @@ use std::collections::HashMap;
1818use std:: { cmp, fmt} ;
1919
2020pub use clarity_serialization:: errors:: CostErrors ;
21- pub use clarity_serialization:: execution_cost:: ExecutionCost ;
21+ pub use clarity_serialization:: execution_cost:: { CostOverflowingMath , ExecutionCost } ;
2222use costs_1:: Costs1 ;
2323use costs_2:: Costs2 ;
2424use costs_2_testnet:: Costs2Testnet ;
@@ -1253,28 +1253,6 @@ impl CostTracker for &mut LimitedCostTracker {
12531253 }
12541254}
12551255
1256- pub trait CostOverflowingMath < T > {
1257- fn cost_overflow_mul ( self , other : T ) -> Result < T > ;
1258- fn cost_overflow_add ( self , other : T ) -> Result < T > ;
1259- fn cost_overflow_sub ( self , other : T ) -> Result < T > ;
1260- fn cost_overflow_div ( self , other : T ) -> Result < T > ;
1261- }
1262-
1263- impl CostOverflowingMath < u64 > for u64 {
1264- fn cost_overflow_mul ( self , other : u64 ) -> Result < u64 > {
1265- self . checked_mul ( other) . ok_or ( CostErrors :: CostOverflow )
1266- }
1267- fn cost_overflow_add ( self , other : u64 ) -> Result < u64 > {
1268- self . checked_add ( other) . ok_or ( CostErrors :: CostOverflow )
1269- }
1270- fn cost_overflow_sub ( self , other : u64 ) -> Result < u64 > {
1271- self . checked_sub ( other) . ok_or ( CostErrors :: CostOverflow )
1272- }
1273- fn cost_overflow_div ( self , other : u64 ) -> Result < u64 > {
1274- self . checked_div ( other) . ok_or ( CostErrors :: CostOverflow )
1275- }
1276- }
1277-
12781256// ONLY WORKS IF INPUT IS u64
12791257fn int_log2 ( input : u64 ) -> Option < u64 > {
12801258 63_u32 . checked_sub ( input. leading_zeros ( ) ) . map ( |floor_log| {
0 commit comments