summaryrefslogtreecommitdiff
path: root/pod/perlguts.pod
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-11-28 09:36:40 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-11-28 09:36:40 +0000
commitab19240082dfba31ce2fd03e2c5d9e7779bcdc76 (patch)
treea3b8745e8178bdd504a7211ff36303b26b7367de /pod/perlguts.pod
parent31d7d75aac642a364f35c283bcf351a66fe2c5ed (diff)
downloadperl-ab19240082dfba31ce2fd03e2c5d9e7779bcdc76.tar.gz
document changed PERL_HASH()
p4raw-id: //depot/perl@2333
Diffstat (limited to 'pod/perlguts.pod')
-rw-r--r--pod/perlguts.pod10
1 files changed, 6 insertions, 4 deletions
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 7ccb80e15a..b835b59a38 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -350,11 +350,13 @@ This returns NULL if the variable does not exist.
The hash algorithm is defined in the C<PERL_HASH(hash, key, klen)> macro:
- i = klen;
hash = 0;
- s = key;
- while (i--)
- hash = hash * 33 + *s++;
+ while (klen--)
+ hash = (hash * 33) + *key++;
+ hash = hash + (hash >> 5); /* after 5.006 */
+
+The last step was added in version 5.006 to improve distribution of
+lower bits in the resulting hash value.
See L<Understanding the Magic of Tied Hashes and Arrays> for more
information on how to use the hash access functions on tied hashes.