subChecked method

Int64 subChecked(
  1. Int64 other
)

Implementation

Int64 subChecked(Int64 other) {
  var res = value - other.value;
  if ((((value ^ other.value) & 0x8000000000000000) != 0) &&
      (((res ^ value) & 0x8000000000000000) != 0)) {
      throw StateError('Int64 subtraction overflow/underflow');
  }
  return Int64.from(res);
}