mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Fix interpreter exp bug.
This commit is contained in:
		
							parent
							
								
									601439687e
								
							
						
					
					
						commit
						18bc82e6fd
					
				
							
								
								
									
										9
									
								
								test/libyul/yulInterpreterTests/exp.yul
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/libyul/yulInterpreterTests/exp.yul
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | { | ||||||
|  |   mstore(0, exp(3,not(1))) | ||||||
|  | } | ||||||
|  | // ---- | ||||||
|  | // Trace: | ||||||
|  | //   MSTORE_AT_SIZE(0, 32) [8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e39] | ||||||
|  | // Memory dump: | ||||||
|  | //      0: 8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e39 | ||||||
|  | // Storage dump: | ||||||
| @ -42,7 +42,7 @@ u256 exp256(u256 _base, u256 _exponent) | |||||||
| 	u256 result = 1; | 	u256 result = 1; | ||||||
| 	while (_exponent) | 	while (_exponent) | ||||||
| 	{ | 	{ | ||||||
| 		if (static_cast<limb_type>(_exponent) & 1)	// If exponent is odd.
 | 		if (boost::multiprecision::bit_test(_exponent, 0)) | ||||||
| 			result *= _base; | 			result *= _base; | ||||||
| 		_base *= _base; | 		_base *= _base; | ||||||
| 		_exponent >>= 1; | 		_exponent >>= 1; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user