summaryrefslogtreecommitdiff
path: root/dmake/hash.c
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2006-09-25 08:39:55 +0000
committerVladimir Glazounov <vg@openoffice.org>2006-09-25 08:39:55 +0000
commitdb56d4123e2b5feb38812a7aa7a73dc20875c070 (patch)
tree77804c3df978acd3f053230ee00e1390bf1f5cbd /dmake/hash.c
parent8149ed2a4d6e511260a12ad4658a078d9ff2c3dc (diff)
INTEGRATION: CWS dmake46 (1.1.1.1.152); FILE MERGED
2006/07/22 03:48:48 vq 1.1.1.1.152.1: #i10000# Add some comments.
Diffstat (limited to 'dmake/hash.c')
-rw-r--r--dmake/hash.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/dmake/hash.c b/dmake/hash.c
index c2387da4456b..a172995656ba 100644
--- a/dmake/hash.c
+++ b/dmake/hash.c
@@ -1,4 +1,4 @@
-/* RCS $Id: hash.c,v 1.1.1.1 2000-09-22 15:33:25 hr Exp $
+/* RCS $Id: hash.c,v 1.2 2006-09-25 09:39:55 vg Exp $
--
-- SYNOPSIS
-- Hashing function for hash tables.
@@ -38,8 +38,8 @@ Hash( id, phv )/*
compare hash keys instead and compare strings only for those whose 32-bit
hash keys match. (not many) */
-char *id;
-uint32 *phv;
+char *id; /* value */
+uint32 *phv; /* key */
{
register char *p = id;
register uint32 hash = (uint32) 0;
@@ -47,6 +47,8 @@ uint32 *phv;
while( *p ) hash = (hash << 7) + hash + (uint32) (*p++);
*phv = hash = hash + (uint32) (p-id);
+ /* return an index (for Macs[]) where all keys with the same remainder
+ * after integer division with HASH_TABLE_SIZE are stored. */
return( (uint16) (hash % HASH_TABLE_SIZE) );
}