operator << method

  1. @override
Int64 operator <<(
  1. int n
)
override

Left bit-shift operator.

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

Implementation

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

  int res0, res1, res2;
  if (n < _BITS) {
    res0 = _l << n;
    res1 = (_m << n) | (_l >> (_BITS - n));
    res2 = (_h << n) | (_m >> (_BITS - n));
  } else if (n < _BITS01) {
    res0 = 0;
    res1 = _l << (n - _BITS);
    res2 = (_m << (n - _BITS)) | (_l >> (_BITS01 - n));
  } else {
    res0 = 0;
    res1 = 0;
    res2 = _l << (n - _BITS01);
  }

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