ParagonIE_Sodium_Core32_Int64
- Source
wp-includes/sodium_compat/src/Core32/Int64.php:10
Class ParagonIE_Sodium_Core32_Int64
Description
Encapsulates a 64-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 · 33
- __construct()ParagonIE_Sodium_Core32_Int64 constructor.
- addInt64()Adds two int64 objects
- addInt()Adds a normal integer to an int64 object
- compareInt()
- isGreaterThan()
- isLessThanInt()
- mask64()
- mulInt()
- ctSelect()
- multiplyLong()
- mulIntFast()
- mulInt64Fast()
- mulInt64()
- orInt64()OR this 64-bit integer with another.
- rotateLeft()
- rotateRight()Rotate to the right
- shiftLeft()
- shiftRight()
- subInt()Subtract a normal integer from an int64 object.
- subInt64()The difference between two Int64 objects.
- xorInt64()XOR this 64-bit integer with another.
- fromInts()
- fromInt()
- toInt()
- fromString()
- fromReverseString()
- toArray()
- toInt32()
- toInt64()
- setUnsignedInt()
- toString()
- toReverseString()
- __toString()
Source code
class ParagonIE_Sodium_Core32_Int64{ /** * @var array<int, int> - four 16-bit integers */ public $limbs = array(0, 0, 0, 0); /** * @var int */ public $overflow = 0; /** * @var bool */ public $unsignedInt = false; /** * ParagonIE_Sodium_Core32_Int64 constructor. * @param array $array * @param bool $unsignedInt */ public function __construct($array = array(0, 0, 0, 0), $unsignedInt = false) { $this->limbs = array( (int) $array[0], (int) $array[1], (int) $array[2], (int) $array[3] ); $this->overflow = 0; $this->unsignedInt = $unsignedInt; } /** * Adds two int64 objects * * @param ParagonIE_Sodium_Core32_Int64 $addend * @return ParagonIE_Sodium_Core32_Int64 */ public function addInt64(ParagonIE_Sodium_Core32_Int64 $addend) { $i0 = $this->limbs[0]; $i1 = $this->limbs[1]; $i2 = $this->limbs[2]; $i3 = $this->limbs[3]; $j0 = $addend->limbs[0]; $j1 = $addend->limbs[1]; $j2 = $addend->limbs[2]; $j3 = $addend->limbs[3]; $r3 = $i3 + ($j3 & 0xffff); $carry = $r3 >> 16; $r2 = $i2 + ($j2 & 0xffff) + $carry; $carry = $r2 >> 16; $r1 = $i1 + ($j1 & 0xffff) + $carry; $carry = $r1 >> 16; $r0 = $i0 + ($j0 & 0xffff) + $carry; $carry = $r0 >> 16; $r0 &= 0xffff; $r1 &= 0xffff; $r2 &= 0xffff; $r3 &= 0xffff; $return = new ParagonIE_Sodium_Core32_Int64( array($r0, $r1, $r2, $r3) ); $return->overflow = $carry; $return->unsignedInt = $this->unsignedInt; return $return; } /** * Adds a normal integer to an int64 object * * @param int $intChangelog
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/Int64.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.