subChecked method

I16 subChecked(
  1. I16 other
)

Subtracts another I16 from this, throwing a StateError on overflow or underflow.

Implementation

I16 subChecked(I16 other) {
  var result = value - other.value;
  if (result > 32767 || result < -32768) {
    throw StateError('I16 subtraction overflow');
  }
  return I16(result);
}