diff options
author | DJ Delorie <dj@redhat.com> | 2001-08-17 06:33:05 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2001-08-17 06:33:05 +0000 |
commit | 8fc34799029ef55fd64a6cd72d592aee9e8ac074 (patch) | |
tree | 173692f92beb672dae3391f7b39c015666209011 /libiberty/hashtab.c | |
parent | e9e69f5a09a9cfde95670fe39ec1b9c1e4e8749f (diff) | |
download | gdb-8fc34799029ef55fd64a6cd72d592aee9e8ac074.zip gdb-8fc34799029ef55fd64a6cd72d592aee9e8ac074.tar.gz gdb-8fc34799029ef55fd64a6cd72d592aee9e8ac074.tar.bz2 |
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 274ad9e..2807802 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; +} |