2020-05-11 17:56:29 +00:00
|
|
|
contract C {
|
|
|
|
function f(int a, int b) public pure returns (int) {
|
|
|
|
return a % b;
|
|
|
|
}
|
2020-09-30 22:13:03 +00:00
|
|
|
function g(bool _check) public pure returns (int) {
|
|
|
|
int x = type(int).min;
|
|
|
|
if (_check) {
|
|
|
|
return x / -1;
|
|
|
|
} else {
|
|
|
|
unchecked { return x / -1; }
|
|
|
|
}
|
|
|
|
}
|
2020-05-11 17:56:29 +00:00
|
|
|
}
|
|
|
|
// ----
|
|
|
|
// f(int256,int256): 7, 5 -> 2
|
|
|
|
// f(int256,int256): 7, -5 -> 2
|
|
|
|
// f(int256,int256): -7, 5 -> -2
|
|
|
|
// f(int256,int256): -7, 5 -> -2
|
|
|
|
// f(int256,int256): -5, -5 -> 0
|
2020-10-13 11:28:39 +00:00
|
|
|
// g(bool): true -> FAILURE, hex"4e487b71", 0x11
|
2020-09-30 22:13:03 +00:00
|
|
|
// g(bool): false -> -57896044618658097711785492504343953926634992332820282019728792003956564819968
|