mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
27 lines
628 B
Solidity
27 lines
628 B
Solidity
type Bool is bool;
|
|
using {bitor as |, bitand as &, bitnot as ~} for Bool global;
|
|
|
|
function bitor(Bool x, Bool y) pure returns (Bool) {
|
|
return Bool.wrap(Bool.unwrap(x) || Bool.unwrap(y));
|
|
}
|
|
|
|
function bitand(Bool x, Bool y) pure returns (Bool) {
|
|
return Bool.wrap(Bool.unwrap(x) && Bool.unwrap(y));
|
|
}
|
|
|
|
function bitnot(Bool x) pure returns (Bool) {
|
|
return Bool.wrap(!Bool.unwrap(x));
|
|
}
|
|
|
|
function b(bool x) pure suffix returns (Bool) {
|
|
return Bool.wrap(x);
|
|
}
|
|
|
|
contract C {
|
|
function test() public pure returns (Bool) {
|
|
return ~ ~ ~(false b | true b & ~false b) & true b;
|
|
}
|
|
}
|
|
// ----
|
|
// test() -> false
|