toSafeUInt64 method

int toSafeUInt64()

Converts the number to a valid uint64 value.

If the value is below 0 or above maxSafeInteger, an overflow is assumend and maxSafeInteger is returned. Otherwise, the value of this is returned as int.

Implementation

int toSafeUInt64() {
  if (this < 0 || this > maxSafeInteger) {
    return maxSafeInteger;
  } else {
    return toInt();
  }
}