ParagonIE_Sodium_Core32_Int32::shiftRight() 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->shiftRight( $c );
- $c(int)
- -
Code of ParagonIE_Sodium_Core32_Int32::shiftRight() ParagonIE Sodium Core32 Int32::shiftRight WP 5.7.1
public function shiftRight($c = 0)
{
ParagonIE_Sodium_Core32_Util::declareScalarType($c, 'int', 1);
/** @var int $c */
$c = (int) $c;
$return = new ParagonIE_Sodium_Core32_Int32();
$return->unsignedInt = $this->unsignedInt;
$c &= 63;
/** @var int $c */
if ($c >= 16) {
$return->limbs = array(
(int) ($this->overflow & 0xffff),
(int) ($this->limbs[0])
);
$return->overflow = $this->overflow >> 16;
return $return->shiftRight($c & 15);
}
if ($c === 0) {
$return->limbs = $this->limbs;
} elseif ($c < 0) {
/** @var int $c */
return $this->shiftLeft(-$c);
} else {
if (!is_int($c)) {
throw new TypeError();
}
/** @var int $c */
// $return->limbs[0] = (int) (($this->limbs[0] >> $c) & 0xffff);
$carryLeft = (int) ($this->overflow & ((1 << ($c + 1)) - 1));
$return->limbs[0] = (int) ((($this->limbs[0] >> $c) | ($carryLeft << (16 - $c))) & 0xffff);
$carryRight = (int) ($this->limbs[0] & ((1 << ($c + 1)) - 1));
$return->limbs[1] = (int) ((($this->limbs[1] >> $c) | ($carryRight << (16 - $c))) & 0xffff);
$return->overflow >>= $c;
}
return $return;
}