ParagonIE_Sodium_Core32_Int32::mulInt32Fast() public WP 1.0
{} It's a method of the class: ParagonIE_Sodium_Core32_Int32{}
No Hooks.
Return
ParagonIE_Sodium_Core32_Int32
. Null. Nothing.
Usage
$ParagonIE_Sodium_Core32_Int32 = new ParagonIE_Sodium_Core32_Int32(); $ParagonIE_Sodium_Core32_Int32->mulInt32Fast( $right );
- $right(ParagonIE_Sodium_Core32_int32) (required)
- -
Code of ParagonIE_Sodium_Core32_Int32::mulInt32Fast() ParagonIE Sodium Core32 Int32::mulInt32Fast WP 5.7
public function mulInt32Fast(ParagonIE_Sodium_Core32_Int32 $right)
{
$aNeg = ($this->limbs[0] >> 15) & 1;
$bNeg = ($right->limbs[0] >> 15) & 1;
$a = array_reverse($this->limbs);
$b = array_reverse($right->limbs);
if ($aNeg) {
for ($i = 0; $i < 2; ++$i) {
$a[$i] = ($a[$i] ^ 0xffff) & 0xffff;
}
++$a[0];
}
if ($bNeg) {
for ($i = 0; $i < 2; ++$i) {
$b[$i] = ($b[$i] ^ 0xffff) & 0xffff;
}
++$b[0];
}
$res = $this->multiplyLong($a, $b);
if ($aNeg !== $bNeg) {
if ($aNeg !== $bNeg) {
for ($i = 0; $i < 2; ++$i) {
$res[$i] = ($res[$i] ^ 0xffff) & 0xffff;
}
$c = 1;
for ($i = 0; $i < 2; ++$i) {
$res[$i] += $c;
$c = $res[$i] >> 16;
$res[$i] &= 0xffff;
}
}
}
$return = new ParagonIE_Sodium_Core32_Int32();
$return->limbs = array(
$res[1] & 0xffff,
$res[0] & 0xffff
);
if (count($res) > 2) {
$return->overflow = $res[2];
}
return $return;
}