diff options
author | DJ Delorie <dj@delorie.com> | 2001-08-17 06:33:05 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2001-08-17 06:33:05 +0000 |
commit | 1c1a41de3c18b59ad2a210c6b458fcdbe38709ed (patch) | |
tree | bf455f071aed05409f7e402b8497f300d701a5eb /libiberty/hashtab.c | |
parent | 1d918802c8fc243ca6a84680645173e2f368e03c (diff) | |
download | gdb-1c1a41de3c18b59ad2a210c6b458fcdbe38709ed.tar.gz |
merge from gcc
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; +} |