Int64 constructor Null safety

Int64(
  1. [int value = 0]
)

Constructs an Int64 with a given int value; zero by default.

Implementation

factory Int64([int value = 0]) {
  int v0 = 0, v1 = 0, v2 = 0;
  bool negative = false;
  if (value < 0) {
    negative = true;
    value = -value;
  }
  // Avoid using bitwise operations that in JavaScript coerce their input to
  // 32 bits.
  v2 = value ~/ 17592186044416; // 2^44
  value -= v2 * 17592186044416;
  v1 = value ~/ 4194304; // 2^22
  value -= v1 * 4194304;
  v0 = value;

  return negative
      ? Int64._negate(_MASK & v0, _MASK & v1, _MASK2 & v2)
      : Int64._masked(v0, v1, v2);
}