function NativeCalculator::doCmp
Compares two non-signed large numbers.
@psalm-return -1|0|1
2 calls to NativeCalculator::doCmp()
- NativeCalculator::doDiv in vendor/
brick/ math/ src/ Internal/ Calculator/ NativeCalculator.php - Performs the division of two non-signed large integers.
- NativeCalculator::doSub in vendor/
brick/ math/ src/ Internal/ Calculator/ NativeCalculator.php - Performs the subtraction of two non-signed large integers.
File
-
vendor/
brick/ math/ src/ Internal/ Calculator/ NativeCalculator.php, line 532
Class
- NativeCalculator
- Calculator implementation using only native PHP code.
Namespace
Brick\Math\Internal\CalculatorCode
private function doCmp(string $a, string $b) : int {
$x = \strlen($a);
$y = \strlen($b);
$cmp = $x <=> $y;
if ($cmp !== 0) {
return $cmp;
}
return \strcmp($a, $b) <=> 0;
// enforce -1|0|1
}