addChecked method

Uint64 addChecked(
  1. Uint64 other
)

Adds other catching overflow.

Implementation

Uint64 addChecked(Uint64 other) {
  final res = value + other.value;
  if ((res ^ 0x8000000000000000) < (value ^ 0x8000000000000000)) {
    throw StateError('Uint64 addition overflow');
  }
  return Uint64.from(res);
}