operator & method

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

Bit-wise and operator.

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

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

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

Implementation

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