ParagonIE_Sodium_Core_Util::abs

Advertisement

Syntax Syntax

ParagonIE_Sodium_Core_Util::abs( int $integer, int $size )

Parameters Parameters

$integer

(Required)

$size

(Required) (16, 32, 64)

Return Return

(int)

Source Source

File: wp-includes/sodium_compat/src/Core/Util.php

    public static function abs($integer, $size = 0)
    {
        /** @var int $realSize */
        $realSize = (PHP_INT_SIZE << 3) - 1;
        if ($size) {
            --$size;
        } else {
            /** @var int $size */
            $size = $realSize;
        }

        $negative = -(($integer >> $size) & 1);
        return (int) (
            ($integer ^ $negative)
                +
            (($negative >> $realSize) & 1)
        );
    }

Advertisement

Advertisement

Leave a Reply