Eric Blake <e...@byu.net> writes:

>  static size_t
>  raw_hasher (const void *data, size_t n)
>  {
> -  return (size_t) data % n;
> +  /* When hashing unique pointers, it is often the case that they were
> +     generated by malloc and thus have the property that the low-order
> +     bits are 0.  As this tends to give poorer performance with small
> +     tables, we rotate the pointer value before performing division,
> +     in an attempt to improve hash quality.  */
> +  size_t val = data;

I would expect this initialization of an integer from a pointer
without a cast to provoke a warning.
-- 
Ben Pfaff 
http://benpfaff.org



Reply via email to