mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
42 lines
859 B
Solidity
42 lines
859 B
Solidity
contract C {
|
|
function eq() public pure returns (bool) {
|
|
uint8 x = 1; uint8 y;
|
|
assembly { y := 0x0101 }
|
|
return (x == y);
|
|
}
|
|
function neq() public pure returns (bool) {
|
|
uint8 x = 1; uint8 y;
|
|
assembly { y := 0x0101 }
|
|
return (x != y);
|
|
}
|
|
function geq() public pure returns (bool) {
|
|
uint8 x = 1; uint8 y;
|
|
assembly { y := 0x0101 }
|
|
return (x >= y);
|
|
}
|
|
function leq() public pure returns (bool) {
|
|
uint8 x = 2; uint8 y;
|
|
assembly { y := 0x0101 }
|
|
return (x <= y);
|
|
}
|
|
function gt() public pure returns (bool) {
|
|
uint8 x = 2; uint8 y;
|
|
assembly { y := 0x0101 }
|
|
return (x > y);
|
|
}
|
|
function lt() public pure returns (bool) {
|
|
uint8 x = 1; uint8 y;
|
|
assembly { y := 0x0101 }
|
|
return (x < y);
|
|
}
|
|
}
|
|
// ====
|
|
// compileViaYul: also
|
|
// ----
|
|
// eq() -> true
|
|
// neq() -> false
|
|
// geq() -> true
|
|
// leq() -> false
|
|
// gt() -> true
|
|
// lt() -> false
|