Skip to content

Commit

Permalink
Improve crc32-based getValueHash method to work better on 32 and 64 b…
Browse files Browse the repository at this point in the history
…it machines.
  • Loading branch information
bnowack committed Dec 12, 2013
1 parent 5e0701d commit 8a35ff1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions store/ARC2_Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,11 @@ function processTriggers($type, $infos) {
/* */

function getValueHash($val, $_32bit = false) {
$hash = abs(crc32($val));
$hash = crc32($val);
if ($_32bit && ($hash & 0x80000000)) {
$hash ^= 0xffffffff;
$hash += 1;
$hash = sprintf("%u", $hash);
}
$hash = abs($hash);
return $hash;
}

Expand Down

0 comments on commit 8a35ff1

Please sign in to comment.