2020-03-09 21:14:07 +00:00
|
|
|
contract C {
|
|
|
|
function leftU(uint8 x, uint8 y) public returns (uint8) {
|
|
|
|
return x << y;
|
|
|
|
}
|
|
|
|
|
2020-05-11 22:06:25 +00:00
|
|
|
function leftS(int8 x, uint8 y) public returns (int8) {
|
2020-03-09 21:14:07 +00:00
|
|
|
return x << y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-20 21:16:42 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-03-09 21:14:07 +00:00
|
|
|
// ----
|
|
|
|
// leftU(uint8,uint8): 255, 8 -> 0
|
|
|
|
// leftU(uint8,uint8): 255, 1 -> 254
|
|
|
|
// leftU(uint8,uint8): 255, 0 -> 255
|
2020-05-11 22:06:25 +00:00
|
|
|
// leftS(int8,uint8): 1, 7 -> -128 # Result is -128 and output is sign-extended, not zero-padded. #
|
|
|
|
// leftS(int8,uint8): 1, 6 -> 64
|