On Mon, May 16, 2005 at 05:26:36PM -0700, Mark Mitchell wrote:
> 2005-05-16  Mark Mitchell  <[EMAIL PROTECTED]>
> 
>       * gcc.dg/compat/generate-random.c (config.h): Do not include.
>       (limits.h): Include unconditionally.
>       (stdlib.h): Likewise.
>       * gcc.dg/compat/generate-random_r.c (config.h): Do not include.
>       (limits.h): Include unconditionally.
>       (stdlib.h): Likewise.
>       * gcc.dg/compat/struct-layout-1.exp: Do not link with libiberty.
>       * gcc.dg/compat/struct-layout-1_generate.c (config.h): Do not include.
>       (limits.h): Include unconditionally.
>       (stdlib.h): Likewise. 
>       (hashtab.h): Do not include.
>       (getopt.h): Likewise.
>       (stddef.h): Include.
>       (hashval_t): Define.
>       (struct entry): Add "next" field.
>       (HASH_SIZE): New macro.
>       (hash_table): New variable.
>       (switchfiles): Do not use xmalloc.
>       (mix): New macro.
>       (iterative_hash): New function.
>       (hasht): Remove.
>       (e_exists): New function.
>       (e_insert): Likewise.
>       (output): Use, instead of libiberty hashtable functions.
>       (main): Do not use getopt.  Do not call htab_create.

Thanks.

> + static hashval_t
> + iterative_hash (const void *k_in /* the key */,
> +                 register size_t  length /* the length of the key */,
> +                 register hashval_t initval /* the previous hash, or
> +                                               an arbitrary value */)
> + {
> +   register const unsigned char *k = (const unsigned char *)k_in;
> +   register hashval_t a,b,c,len;
> + 
> +   /* Set up the internal state */
> +   len = length;
> +   a = b = 0x9e3779b9;  /* the golden ratio; an arbitrary value */
> +   c = initval;           /* the previous hash value */
> + 
> +   /*---------------------------------------- handle most of the key */
> + #ifndef WORDS_BIGENDIAN
> +   /* On a little-endian machine, if the data is 4-byte aligned we can hash
> +      by word for better speed.  This gives nondeterministic results on
> +      big-endian machines.  */

WORDS_BIGENDIAN is not being defined in the headers that are included.
I think best would be just to kill this hunk and unconditionally do it the
slower way.

> +   if (sizeof (hashval_t) == 4 && (((size_t)k)&3) == 0)
> +     while (len >= 12)    /* aligned */
> +       {
> +     a += *(hashval_t *)(k+0);
> +     b += *(hashval_t *)(k+4);
> +     c += *(hashval_t *)(k+8);
> +     mix(a,b,c);
> +     k += 12; len -= 12;
> +       }
> +   else /* unaligned */
> + #endif
> +     while (len >= 12)
> +       {
> +     a += (k[0] +((hashval_t)k[1]<<8) +((hashval_t)k[2]<<16) 
> +((hashval_t)k[3]<<24));
> +     b += (k[4] +((hashval_t)k[5]<<8) +((hashval_t)k[6]<<16) 
> +((hashval_t)k[7]<<24));
> +     c += (k[8] +((hashval_t)k[9]<<8) 
> +((hashval_t)k[10]<<16)+((hashval_t)k[11]<<24));
> +     mix(a,b,c);
> +     k += 12; len -= 12;
> +       }

        Jakub

Reply via email to