mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			585 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			585 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
// Tests transition between short and long encoding both ways
 | 
						|
contract c {
 | 
						|
    bytes data;
 | 
						|
 | 
						|
    function test() public returns (uint256) {
 | 
						|
        for (uint8 i = 0; i < 33; i++) {
 | 
						|
            data.push(bytes1(i));
 | 
						|
        }
 | 
						|
        for (uint8 i = 0; i < data.length; i++)
 | 
						|
            if (data[i] != bytes1(i)) return i;
 | 
						|
        data.pop();
 | 
						|
        data.pop();
 | 
						|
        for (uint8 i = 0; i < data.length; i++)
 | 
						|
            if (data[i] != bytes1(i)) return i;
 | 
						|
        return 0;
 | 
						|
    }
 | 
						|
}
 | 
						|
// ----
 | 
						|
// test() -> 0
 | 
						|
// gas irOptimized: 125584
 | 
						|
// gas legacy: 150372
 | 
						|
// gas legacyOptimized: 146391
 |