projects
/
platform
/
upstream
/
perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a507731
)
Allow for really big keys in Tie::SubstrHash
author
Unknown Contributor
<data-drift@so.uio.no>
Tue, 28 Jan 1997 20:14:34 +0000
(21:14 +0100)
committer
Chip Salzenberg
<chip@atlantic.net>
Wed, 29 Jan 1997 06:11:00 +0000
(18:11 +1200)
private-msgid: <
199701282014
.VAA12645@selters.uio.no>
lib/Tie/SubstrHash.pm
patch
|
blob
|
history
diff --git
a/lib/Tie/SubstrHash.pm
b/lib/Tie/SubstrHash.pm
index 825f30571469a6bcd9143122daa392e46511a823..44c2140c7beb2faa7a90f9712f7089b70df902f7 100644
(file)
--- a/
lib/Tie/SubstrHash.pm
+++ b/
lib/Tie/SubstrHash.pm
@@
-144,13
+144,17
@@
sub hashkey {
$hash = 2;
for (unpack('C*', $key)) {
$hash = $hash * 33 + $_;
+ &_hashwrap if $hash >= 1e13;
}
- $hash = $hash - int($hash / $tsize) * $tsize
- if $hash >= $tsize;
+ &_hashwrap if $hash >= $tsize;
$hash = 1 unless $hash;
$hashbase = $hash;
}
+sub _hashwrap {
+ $hash -= int($hash / $tsize) * $tsize;
+}
+
sub rehash {
$hash += $hashbase;
$hash -= $tsize if $hash >= $tsize;