ParagonIE_Sodium_Core32_Int32::addInt32

Advertisement

Summery Summery

Adds two int32 objects

Syntax Syntax

ParagonIE_Sodium_Core32_Int32::addInt32( ParagonIE_Sodium_Core32_Int32 $addend )

Parameters Parameters

$addend

(ParagonIE_Sodium_Core32_Int32) (Required)

Return Return

(ParagonIE_Sodium_Core32_Int32)

Source Source

File: wp-includes/sodium_compat/src/Core32/Int32.php

    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;
    }

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.