mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
16 lines
377 B
Solidity
16 lines
377 B
Solidity
|
contract C {
|
||
|
function f() public pure returns (bytes32 r) {
|
||
|
bytes4 x = 0xffffffff;
|
||
|
bytes2 y = bytes2(x);
|
||
|
assembly {
|
||
|
r := y
|
||
|
}
|
||
|
// At this point, r and y both store four bytes, but
|
||
|
// y is properly cleaned before the equality check
|
||
|
require(y == bytes2(0xffff));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ----
|
||
|
// f() -> "\xff\xff\xff\xff"
|