* hashtab.c (htab_hash_string): New.

From-SVN: r44950
This commit is contained in:
Richard Henderson 2001-08-16 18:54:43 -07:00 committed by Richard Henderson
parent 457f49df10
commit 9e0ba68596
2 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2001-08-16 Richard Henderson <rth@redhat.com>
* hashtab.c (htab_hash_string): New.
2001-08-13 Andrew Cagney <ac131313@redhat.com>
* floatformat.c (floatformat_ieee_double_littlebyte_bigword): Fix

View File

@ -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;
}