multiplication32 method

dynamic multiplication32(
  1. int n1,
  2. int n2
)

Implementation

multiplication32(int n1,
    int n2) // emulates overflow of a c 32-bits unsiged integer variable, instead of the operator *. these both arguments must be non-negative integers expressible using unsigned 32 bits.
{
  var sum = 0;
  for (var i = 0; i < 32; ++i) {
    if (((n1 >> i) & 0x1) > 0) {
      sum = addition32(sum, unsigned32(n2 << i));
    }
  }
  return sum;
}