mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7026 from ethereum/asmConstants
Support direct constants in inline assembly.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
uint constant a = 2;
|
||||
bytes2 constant b = 0xabcd;
|
||||
bytes3 constant c = "abc";
|
||||
bool constant d = true;
|
||||
address payable constant e = 0x1212121212121212121212121212121212121212;
|
||||
function f() public pure returns (uint w, bytes2 x, bytes3 y, bool z, address t) {
|
||||
assembly {
|
||||
w := a
|
||||
x := b
|
||||
y := c
|
||||
z := d
|
||||
t := e
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f() -> 2, left(0xabcd), left(0x616263), true, 0x1212121212121212121212121212121212121212
|
||||
Reference in New Issue
Block a user