operator | method

Obj<int> operator |(
  1. Obj<int> other
)

Bit-wise or operator.

Treating both this and other as sufficiently large two's component integers, the result is a number with the bits set that are set in either of this and other

If both operands are non-negative, the result is non-negative, otherwise the result is negative.

Example:

print((Obj(2) | Obj(1)).toRadixString(2)); // 0010 | 0001 -> 0011
print((Obj(3) | Obj(1)).toRadixString(2)); // 0011 | 0001 -> 0011
print((Obj(10) | Obj(2)).toRadixString(2)); // 1010 | 0010 -> 1010

Implementation

Obj<int> operator |(Obj<int> other) => Obj(value | other.value);