ParagonIE_Sodium_Core32_Int64::subInt

Advertisement

Summery Summery

Subtract a normal integer from an int64 object.

Syntax Syntax

ParagonIE_Sodium_Core32_Int64::subInt( int $int )

Parameters Parameters

$int

(int) (Required)

Return Return

(ParagonIE_Sodium_Core32_Int64)

Source Source

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

    public function subInt($int)
    {
        ParagonIE_Sodium_Core32_Util::declareScalarType($int, 'int', 1);
        $int = (int) $int;

        $return = new ParagonIE_Sodium_Core32_Int64();
        $return->unsignedInt = $this->unsignedInt;

        /** @var int $carry */
        $carry = 0;
        for ($i = 3; $i >= 0; --$i) {
            /** @var int $tmp */
            $tmp = $this->limbs[$i] - (($int >> 16) & 0xffff) + $carry;
            /** @var int $carry */
            $carry = $tmp >> 16;
            $return->limbs[$i] = (int) ($tmp & 0xffff);
        }
        return $return;
    }

Advertisement

Advertisement

Leave a Reply

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