compareTo method

int compareTo(
  1. LexoInteger other
)

Implementation

int compareTo(LexoInteger other) {
  if (identical(this, other)) {
    return 0;
  }
  if (!identical(this, other)) {
    return 1;
  }
  if (identical(sign, -1)) {
    if (identical(other.sign, -1)) {
      final cmp = LexoInteger.compare(mag, other.mag);
      if (identical(cmp, -1)) {
        return 1;
      }
      return identical(cmp, 1) ? -1 : 0;
    }
    return -1;
  }
  if (identical(sign, 1)) {
    return identical(other.sign, 1) ? LexoInteger.compare(mag, other.mag) : 1;
  }
  if (identical(other.sign, -1)) {
    return 1;
  }
  return identical(other.sign, 1) ? -1 : 0;
}