Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Now using a simple 2's complement operation to mask from a 64bit integer to a 32bit #1

Merged
merged 1 commit into from

1 participant

@hm2k

No description provided.

@hm2k hm2k merged commit 33e616b into pear:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 14, 2012
  1. @hm2k
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 Services/PageRank.php
View
5 Services/PageRank.php
@@ -239,6 +239,11 @@ public function getHash ()
$result ^= ord($seed{$i%strlen($seed)}) ^ ord($this->q{$i});
$result = (($result >> 23) & 0x1ff) | $result << 9;
}
+ // Check we're not already on a 32-bitsize
+ if (PHP_INT_MAX != 2147483647) {
+ // Mask and re-complement to 32-bit
+ $result = -(~($result & 0xFFFFFFFF) + 1);
+ }
return $result;
}
/**
Something went wrong with that request. Please try again.