mulChecked method

Uint64 mulChecked(
  1. Uint64 other
)

Throws StateError instead of wrapping on overflow.

Implementation

Uint64 mulChecked(Uint64 other) {
  if (isZero || other.isZero) return Uint64.zero;
  final r = this * other;
  if (r ~/ other != this) throw IntegerError.overflow;
  return r;
}