This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
elem_hash.h
- To: libc-alpha at sources dot redhat dot com
- Subject: elem_hash.h
- From: Isamu Hasegawa <isamu at yamato dot ibm dot com>
- Date: Thu, 09 Aug 2001 13:14:58 +0900
Hello,
In libc/locale/elem-hash.h
> static inline int32_t
> elem_hash (const char *str, int_fast32_t n)
> {
> int32_t result = n;
>
> while (n > 0)
> {
> n <<= 3;
> n += *str++;
> }
>
> return result;
> }
`elem_hash' seems to return just the argument `n'.
It's incorrect behavior, isn't it?
And is the following fix appropriate?
Thanks,
--
Isamu Hasegawa
IBM Japan, Ltd.
--- libc/locale/elem-hash.h Tue Jul 24 13:36:49 2001
+++ libc/locale/elem-hash.h.tmp Thu Aug 9 13:14:36 2001
@@ -26,8 +26,9 @@
while (n > 0)
{
- n <<= 3;
- n += *str++;
+ result <<= 3;
+ result += *str++;
+ n--;
}
return result;