projects
/
platform
/
upstream
/
nasm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b938e04
)
Force use of integer values for generating hash keys.
author
Chuck Crayne
<ccrayne@users.sourceforge.net>
Sun, 2 Sep 2007 01:00:34 +0000
(
01:00
+0000)
committer
Chuck Crayne
<ccrayne@users.sourceforge.net>
Sun, 2 Sep 2007 01:00:34 +0000
(
01:00
+0000)
perllib/phash.ph
patch
|
blob
|
history
diff --git
a/perllib/phash.ph
b/perllib/phash.ph
index
679dc4f
..
4339d58
100644
(file)
--- a/
perllib/phash.ph
+++ b/
perllib/phash.ph
@@
-13,6
+13,7
@@
require 'random_sv_vectors.ph';
# 32-bit rotate
#
sub rot($$) {
+ use integer;
my($v,$s) = @_;
return (($v << $s)+($v >> (32-$s))) & 0xffffffff;
@@
-24,6
+25,7
@@
sub rot($$) {
# prehash(key, sv, N)
#
sub prehash($$$) {
+ use integer;
my($key, $n, $sv) = @_;
my $c;
my $k1 = 0, $k2 = 0;
@@
-37,8
+39,8
@@
sub prehash($$$) {
}
# Create a bipartite graph...
- $k1 = (($k1
% $n
) << 1) + 0;
- $k2 = (($k2
% $n
) << 1) + 1;
+ $k1 = (($k1
& ($n-1)
) << 1) + 0;
+ $k2 = (($k2
& ($n-1)
) << 1) + 1;
return ($k1, $k2);
}