mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			422 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			422 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
pragma abicoder v2;
 | 
						|
 | 
						|
library L {
 | 
						|
    function reverse(bytes calldata _b) internal pure returns (bytes1, bytes1) {
 | 
						|
        return (_b[1], _b[0]);
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
contract C {
 | 
						|
    using L for bytes;
 | 
						|
 | 
						|
    function test(uint, bytes calldata _b, uint) external pure returns (bytes1, bytes1) {
 | 
						|
        return _b.reverse();
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
// ====
 | 
						|
// compileViaYul: also
 | 
						|
// ----
 | 
						|
// test(uint256,bytes,uint256): 7, 0x60, 4, 2, "ab" -> "b", "a"
 |