solidity/test/libsolidity/semanticTests/array/fixed_bytes_index_access.sol
2020-03-26 17:47:36 +01:00

18 lines
382 B
Solidity

contract C {
bytes16[] public data;
function f(bytes32 x) public returns (bytes1) {
return x[2];
}
function g(bytes32 x) public returns (uint256) {
data = [x[0], x[1], x[2]];
data[0] = "12345";
return uint256(uint8(data[0][4]));
}
}
// ----
// f(bytes32): "789" -> "9"
// g(bytes32): "789" -> 0x35
// data(uint256): 0x01 -> "8"