This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Make locale archive hash function architecture-independent


> --- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]