operator << method

Uint64 operator <<(
  1. int n
)

Logical (unsigned) left shift. There's no arithmetic-shift distinction for an unsigned type.

Implementation

Uint64 operator <<(int n) {
  final shift = n & 63;
  if (shift == 0) return this;
  if (shift < 32) {
    final hiShifted = _safeShl32(_hi, shift);
    final carryFromLo = _lo >>> (32 - shift); // right shift: always safe
    final newHi = (hiShifted | carryFromLo) & _mask32;
    final newLo = _safeShl32(_lo, shift) & _mask32;
    return Uint64._(newHi, newLo);
  }
  final newHi = _safeShl32(_lo, shift - 32) & _mask32;
  return Uint64._(newHi, 0);
}