mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
25 lines
465 B
Solidity
25 lines
465 B
Solidity
|
contract C {
|
||
|
function f(uint256 a) public returns (uint256 b) {
|
||
|
assembly {
|
||
|
switch a
|
||
|
case 1 {
|
||
|
b := 8
|
||
|
}
|
||
|
case 2 {
|
||
|
b := 9
|
||
|
}
|
||
|
default {
|
||
|
b := 2
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ====
|
||
|
// compileViaYul: also
|
||
|
// ----
|
||
|
// f(uint256): 0 -> 2
|
||
|
// f(uint256): 1 -> 8
|
||
|
// f(uint256): 2 -> 9
|
||
|
// f(uint256): 3 -> 2
|