toSafeUInt32 method

int toSafeUInt32()

Converts the number to a valid uint32 value.

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

Implementation

int toSafeUInt32() {
  if (this < 0 || this > uint32SafeMax) {
    return uint32SafeMax;
  } else {
    return toInt();
  }
}