operator & method

T operator &(
  1. dynamic other
)

位和运算符。 将thisother都视为足够大的二进制分量整数,结果是一个数字,其中只有在thisother中设置的位集 如果两个操作数都为负,则结果为负,否则结果为非负

Implementation

T operator &(dynamic other) {
  if (other is AbstractInt) {
    return valueOf(value & other.value);
  } else if (other is int) {
    return valueOf(value & other);
  } else if (other is BigInt) {
    return valueOf((BigInt.from(value) & other).toInt());
  } else if (other is Decimal) {
    return valueOf((BigInt.from(value) & other.toBigInt()).toInt());
  } else {
    throw UnsupportedError('not support argument: ${other.runtimeType}');
  }
}