diff options
Diffstat (limited to 'libiberty/hashtab.c')
-rw-r--r-- | libiberty/hashtab.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index 274ad9ec207..28078027fef 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -561,3 +561,19 @@ htab_collisions (htab) return (double) htab->collisions / (double) htab->searches; } + +/* Hash P as a null-terminated string. */ + +hashval_t +htab_hash_string (p) + const PTR p; +{ + const unsigned char *str = (const unsigned char *) p; + hashval_t r = 0; + unsigned char c; + + while ((c = *str++) != 0) + r = r * 67 + c - 113; + + return r; +} |