Make locale archive hash function architecture-independent

Roland McGrath roland@hack.frob.com
Mon Sep 23 22:54:00 GMT 2013


> --- a/locale/hashval.h
> +++ b/locale/hashval.h
> @@ -37,7 +37,7 @@ compute_hashval (const void *key, size_t keylen)
>    while (cnt < keylen)
>      {
>        hval = (hval << 9) | (hval >> (sizeof hval * CHAR_BIT - 9));
> -      hval += (hashval_t) *(((char *) key) + cnt++);
> +      hval += (hashval_t) ((unsigned char *) key)[cnt++];

Use const in the cast since we don't intend to drop constness.

Otherwise this looks fine to me (and I concur about using array syntax
whenever possible).


Thanks,
Roland



More information about the Libc-alpha mailing list