Skip to content

Commit 8a35ff1

Browse files
committed
Improve crc32-based getValueHash method to work better on 32 and 64 bit machines.
1 parent 5e0701d commit 8a35ff1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

store/ARC2_Store.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,11 +497,11 @@ function processTriggers($type, $infos) {
497497
/* */
498498

499499
function getValueHash($val, $_32bit = false) {
500-
$hash = abs(crc32($val));
500+
$hash = crc32($val);
501501
if ($_32bit && ($hash & 0x80000000)) {
502-
$hash ^= 0xffffffff;
503-
$hash += 1;
502+
$hash = sprintf("%u", $hash);
504503
}
504+
$hash = abs($hash);
505505
return $hash;
506506
}
507507

0 commit comments

Comments
 (0)