shiftRightUnsigned method

  1. @override
Int64 shiftRightUnsigned(
  1. int n
)
override

Unsigned right-shift operator.

Returns the result of shifting the bits of this integer by shiftAmount bits to the right. High-order bits are filled with zeros.

Implementation

@override
Int64 shiftRightUnsigned(int n) {
  if (n < 0) {
    throw ArgumentError.value(n);
  }
  if (n >= 64) {
    return ZERO;
  }

  int res0, res1, res2;
  int a2 = _MASK2 & _h; // Ensure a2 is positive.
  if (n < _BITS) {
    res2 = a2 >> n;
    res1 = (_m >> n) | (a2 << (_BITS - n));
    res0 = (_l >> n) | (_m << (_BITS - n));
  } else if (n < _BITS01) {
    res2 = 0;
    res1 = a2 >> (n - _BITS);
    res0 = (_m >> (n - _BITS)) | (_h << (_BITS01 - n));
  } else {
    res2 = 0;
    res1 = 0;
    res0 = a2 >> (n - _BITS01);
  }

  return Int64._masked(res0, res1, res2);
}