addChecked method

Int64 addChecked(
  1. Int64 other
)

Implementation

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