Int32 constructor

Int32(
  1. int value
)

Builds from a plain Dart int (positive or negative), truncating to 32 bits like a wrapping cast. value must itself be a normal, double-safe Dart int (true for any literal or value that didn't already come from a wider fixed-width type).

Implementation

factory Int32(int value) {
  if (value >= 0) return Int32._(value & BinaryOps.mask32);
  var v =
      value % 0x100000000; // Dart's % is non-negative for a positive divisor.
  return Int32._(v & BinaryOps.mask32);
}