2020-03-09 21:14:07 +00:00
|
|
|
contract C {
|
|
|
|
int8 a;
|
|
|
|
uint8 b;
|
|
|
|
int8 c;
|
|
|
|
uint8 d;
|
|
|
|
|
|
|
|
function test()
|
|
|
|
public
|
|
|
|
returns (uint256 x1, uint256 x2, uint256 x3, uint256 x4)
|
|
|
|
{
|
|
|
|
a = -2;
|
2020-09-15 14:16:30 +00:00
|
|
|
unchecked {
|
|
|
|
b = (0 - uint8(a)) * 2;
|
|
|
|
c = a * int8(120) * int8(121);
|
|
|
|
}
|
2020-11-09 09:12:38 +00:00
|
|
|
x1 = uint256(int256(a));
|
2020-03-09 21:14:07 +00:00
|
|
|
x2 = b;
|
2020-11-09 09:12:38 +00:00
|
|
|
x3 = uint256(int256(c));
|
2020-03-09 21:14:07 +00:00
|
|
|
x4 = d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-15 14:16:30 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-11-21 20:05:39 +00:00
|
|
|
// compileToEwasm: also
|
2020-03-09 21:14:07 +00:00
|
|
|
// ----
|
|
|
|
// test() -> -2, 4, -112, 0
|