operator >> method

  1. @override
Int32 operator >>(
  1. int n
)
override

Right bit-shift operator.

Returns the result of shifting the bits of this integer by shiftAmount bits to the right. High-order bits are filled with zero in the case where this integer is positive, or one in the case where it is negative.

Implementation

@override
Int32 operator >>(int n) {
  if (n < 0) {
    throw ArgumentError(n);
  }
  if (n >= 32) {
    return isNegative ? const Int32._internal(-1) : ZERO;
  }
  int value;
  if (_i >= 0) {
    value = _i >> n;
  } else {
    value = (_i >> n) | (0xffffffff << (32 - n));
  }
  return Int32(value);
}