public static function ParagonIE_Sodium_Core_Util::abs in Automatic Updates 7
Same name and namespace in other branches
- 8 vendor/paragonie/sodium_compat/src/Core/Util.php \ParagonIE_Sodium_Core_Util::abs()
Parameters
int $integer:
int $size (16, 32, 64):
Return value
int
File
- vendor/
paragonie/ sodium_compat/ src/ Core/ Util.php, line 17
Class
- ParagonIE_Sodium_Core_Util
- Class ParagonIE_Sodium_Core_Util
Code
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));
}