ParagonIE_Sodium_Core32_Int32
- Source
wp-includes/sodium_compat/src/Core32/Int32.php:10
Class ParagonIE_Sodium_Core32_Int32
Description
Encapsulates a 32-bit integer.
These are immutable. It always returns a new instance.
Compatibility
- WordPress
- core
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 3
$limbsarray<int,public$overflowintpublic$unsignedIntboolpublic
Methods · 31
- __construct()ParagonIE_Sodium_Core32_Int32 constructor.
- addInt32()Adds two int32 objects
- addInt()Adds a normal integer to an int32 object
- compareInt()
- mask()
- multiplyLong()
- mulIntFast()
- mulInt32Fast()
- mulInt()
- mulInt32()
- orInt32()OR this 32-bit integer with another.
- isGreaterThan()
- isLessThanInt()
- rotateLeft()
- rotateRight()Rotate to the right
- setUnsignedInt()
- shiftLeft()
- shiftRight()
- subInt()Subtract a normal integer from an int32 object.
- subInt32()Subtract two int32 objects from each other
- xorInt32()XOR this 32-bit integer with another.
- fromInt()
- fromString()
- fromReverseString()
- toArray()
- toString()
- toInt()
- toInt32()
- toInt64()
- toReverseString()
- __toString()
Source code
class ParagonIE_Sodium_Core32_Int32{ /** * @var array<int, int> - two 16-bit integers * * 0 is the higher 16 bits * 1 is the lower 16 bits */ public $limbs = array(0, 0); /** * @var int */ public $overflow = 0; /** * @var bool */ public $unsignedInt = false; /** * ParagonIE_Sodium_Core32_Int32 constructor. * @param array $array * @param bool $unsignedInt */ public function __construct($array = array(0, 0), $unsignedInt = false) { $this->limbs = array( (int) $array[0], (int) $array[1] ); $this->overflow = 0; $this->unsignedInt = $unsignedInt; } /** * Adds two int32 objects * * @param ParagonIE_Sodium_Core32_Int32 $addend * @return ParagonIE_Sodium_Core32_Int32 */ public function addInt32(ParagonIE_Sodium_Core32_Int32 $addend) { $i0 = $this->limbs[0]; $i1 = $this->limbs[1]; $j0 = $addend->limbs[0]; $j1 = $addend->limbs[1]; $r1 = $i1 + ($j1 & 0xffff); $carry = $r1 >> 16; $r0 = $i0 + ($j0 & 0xffff) + $carry; $carry = $r0 >> 16; $r0 &= 0xffff; $r1 &= 0xffff; $return = new ParagonIE_Sodium_Core32_Int32( array($r0, $r1) ); $return->overflow = $carry; $return->unsignedInt = $this->unsignedInt; return $return; } /** * Adds a normal integer to an int32 object * * @param int $int * @return ParagonIE_Sodium_Core32_Int32 * @throws SodiumException * @throws TypeError */ public function addInt($int) { ParagonIE_Sodium_Core32_Util::declareScalarType($int, 'int', 1); /** @var int $int */ $int = (int) $int; $int = (int) $int;Changelog
Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/sodium_compat/src/Core32/Int32.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.