Compares two indices of the heap.

@param int $a
@param int $b

@return int
557603
private function compare(int $a, int $b)
    {
        $x = $this->heap[$a];
        $y = $this->heap[$b];

        // Compare priority, using insertion stamp as fallback.
        return ($x->priority <=> $y->priority) ?: ($y->stamp <=> $x->stamp);
    }
1125859
public static function compareList(array $a, array $b): int
    {
        foreach ($a as $i => $symbol) {
            // $b finished, but $a not yet
            if (!isset($b[$i])) {
                // $a > $b
                return 1;
            }
            // $a[$i] <=> $b[$i]
            $result = static::compare($symbol, $b[$i]);
            if ($result) {
                //# $a[$i] <> $b[$i]
                return $result;
            }
        }
        // $b starts with $a
        // if $b longer then $a
        if (count($b) > count($a)) {
            // $a < $b
            return -1;
        }
        // $a == $b
        return 0;
    }
319084
public static function compare(array $a, array $b)
    {
        if ($a['quality'] !== $b['quality']) {
            return $a['quality'] > $b['quality'] ? -1 : 1;
        }

        if ($a['index'] !== $b['index']) {
            return $a['index'] > $b['index'] ? 1 : -1;
        }

        return 0;
    }
187555
private function compareSearchWeights(Content $a, Content $b)
    {
        if ($a->getSearchResultWeight() > $b->getSearchResultWeight()) {
            return -1;
        }
        if ($a->getSearchResultWeight() < $b->getSearchResultWeight()) {
            return 1;
        }
        if ($a['datepublish'] > $b['datepublish']) {
            // later is more important
            return -1;
        }
        if ($a['datepublish'] < $b['datepublish']) {
            // earlier is less important
            return 1;
        }

        return strcasecmp($a['title'], $b['title']);
    }
93331
public function similarity(&$A, &$B)
    {
        // Make the arrays into sets
        $a = array_fill_keys($A,1);
        $b = array_fill_keys($B,1);

        // Count the cardinalities of the sets
        $a_count = count($a);
        $b_count = count($b);

        if ($a_count == 0 || $b_count == 0) {
            return 0;
        }

        // Compute the intersection and count its cardinality
        $intersect = count(array_intersect_key($a,$b));

        return $intersect/min($a_count,$b_count);
    }
149541
protected function sortCompareValues($a, $b)
    {
        if (is_numeric($a) && is_numeric($b)) {
            return $this->sortCompareNumeric((float)$a, (float)$b);
        }

        if (is_string($a) && is_string($b)) {
            return $this->sortCompareStrings($a, $b);
        }

        return ($a < $b) ? -1 : (int)($a > $b);
    }
766185
public function comp($a, $b)
    {
        return bccomp($this->bcNormalize($a), $this->bcNormalize($b));
    }
1172008
private function compareOptions($a, $b)
    {
        $comparison = $b['priority'] - $a['priority'];

        if ($comparison == 0) {
            return strcasecmp($a['path'], $b['path']);
        }

        return $comparison;
    }
357885
private function _compareMac($a, $b) {
        $result = "\x00";

        for ($i = 0; $i < $this->_macByteCount; $i++) {
            $result |= substr($a, $i, 1) ^ substr($b, $i, 1);
        }
        
        /* \x00 if equal, nonzero otherwise */
        return ($result === "\x00");
    }
16868
private static function slowEquals($a, $b)
    {
        $diff = strlen($a) ^ strlen($b);
        for ($i = 0; $i < strlen($a) && $i < strlen($b); $i++) {
            $diff |= ord($a[$i]) ^ ord($b[$i]);
        }

        return $diff === 0;
    }
1277586
protected function sortActionsByPriority(array $a, array $b)
    {
        $a = isset($a['priority']) ? $a['priority'] : 0;
        $b = isset($b['priority']) ? $b['priority'] : 0;

        if ($a === $b) {
            return 0;
        }
        return ($a < $b) ? (-1) : 1;
    }
1327843
public static function compare(Date $a, Date $b): int
    {
        // Get min/max JD for each date.
        switch ($a->qual1) {
            case 'BEF':
                $amin = $a->minimumJulianDay() - 1;
                $amax = $amin;
                break;
            case 'AFT':
                $amax = $a->maximumJulianDay() + 1;
                $amin = $amax;
                break;
            default:
                $amin = $a->minimumJulianDay();
                $amax = $a->maximumJulianDay();
                break;
        }
        switch ($b->qual1) {
            case 'BEF':
                $bmin = $b->minimumJulianDay() - 1;
                $bmax = $bmin;
                break;
            case 'AFT':
                $bmax = $b->maximumJulianDay() + 1;
                $bmin = $bmax;
                break;
            default:
                $bmin = $b->minimumJulianDay();
                $bmax = $b->maximumJulianDay();
                break;
        }
        if ($amax < $bmin) {
            return -1;
        }

        if ($amin > $bmax && $bmax > 0) {
            return 1;
        }

        if ($amin < $bmin && $amax <= $bmax) {
            return -1;
        }

        if ($amin > $bmin && $amax >= $bmax && $bmax > 0) {
            return 1;
        }

        return 0;
    }
1043713
private static function compareLogLevel( $a, $b )
    {
        static $defs;

        if ( !$defs ){
            $defs = array(
                'F' => LogLevel::FATAL,
                'E' => LogLevel::ERROR,
                'W' => LogLevel::WARNING,
                'I' => LogLevel::INFO,
                'D' => LogLevel::DEBUG,
                'T' => LogLevel::TRACE,
            );
        }

        $a = $defs[$a] ?? LogLevel::INFO;
        $b = $defs[$b] ?? LogLevel::INFO;

        return ($a - $b);
    }
1294275
private function zeroCompare($a, $b)
    {
        return ($this->math->comp($a, '0') <= 0 || $this->math->comp($b, '0') <= 0);
    }
540777
public function compare(NumericTypeInterface $a, NumericTypeInterface $b)
    {
        return $this->compEngine->compare($a, $b);
    }
836161
private static int compareInt(final int a, final int b) {
		int result = 0;
		if (a > b) {
			result = 1;
		} else if (a < b) {
			result = -1;
		}
		return result;
	}
552267
public static function cloud_sort($a, $b) {
        $tagsort = self::$cloudsortfield ?: 'name';

        if (is_numeric($a->$tagsort)) {
            return ($a->$tagsort == $b->$tagsort) ? 0 : ($a->$tagsort > $b->$tagsort) ? 1 : -1;
        } else if (is_string($a->$tagsort)) {
            return strcmp($a->$tagsort, $b->$tagsort);
        } else {
            return 0;
        }
    }