operator << method

  1. @override
ux operator <<(
  1. dynamic other
)
override

Shift the bits of this integer to the left by shiftAmount.

Shifting to the left makes the number larger, effectively multiplying the number by pow(2, shiftIndex).

There is no limit on the size of the result. It may be relevant to limit intermediate values by using the "and" operator with a suitable mask.

It is an error if shiftAmount is negative.

Returns ux

Implementation

@override
ux operator <<(dynamic other) {
  if (other is integer) {
    return ofSameBit(value << other.value);
  } else if (other is int) {
    return ofSameBit(value << other);
  } else {
    throw Exception('Invalid type for operand: ${other.runtimeType}');
  }
}