This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [PATCH 1/9] Improve pointer hash function to include all bits


On Fri, Apr 19, 2013 at 2:31 PM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> 2013-04-18  Andi Kleen <ak@linux.intel.com>
>
>         * hashtab.c (hash_pointer): Move to end of file and reimplement.



> +/* Returns a hash code for pointer P. Simplified version of evahash */
> +
> +static hashval_t
> +hash_pointer (const PTR p)
> +{
> +  intptr_t v = (intptr_t)p;

Space after ')'.

> +  unsigned a, b, c;
> +  a = b = 0x9e3779b9;

Blank line after variable declarations.

> +  if (sizeof(intptr_t) == 4)

Space before '('.

> +    {
> +      /* Mix as 16bit for now */
> +      a += v >> 16;
> +      b += v & 0xffff;
> +    }
> +  else
> +    {
> +      a += v >> 32;
> +      b += v & 0xffffffff;
> +    }
> +  c = 0x42135234;
> +  mix(a, b, c);

Space before '('.

This is OK with those changes if it bootstraps and passes tests.

Thanks.

Ian


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