sub multiply { ($a, $b) = @_; $i=0; $product=0; do { $product += ($a << $i) if ($b & 0x01); $i++; } while ($b>>=1); return $product; }