toInt method

  1. @override
int toInt()

Returns the int representation of this integer.

On some platforms, inputs with large absolute values (i.e., > 2^52) may lose some of their low-order bits.

Implementation

@override
int toInt() {
  int l = _l;
  int m = _m;
  int h = _h;
  // In the sum we add least significant to most significant so that in
  // JavaScript double arithmetic rounding occurs on only the last addition.
  if ((_h & _SIGN_BIT_MASK) != 0) {
    l = _MASK & ~_l;
    m = _MASK & ~_m;
    h = _MASK2 & ~_h;
    return -((1 + l) + (4194304 * m) + (17592186044416 * h));
  } else {
    return l + (4194304 * m) + (17592186044416 * h);
  }
}