Paul Eggert wrote:
> -#else
> -  return ((((x) & 0xff00000000000000ull) >> 56)
> -          | (((x) & 0x00ff000000000000ull) >> 40)
> -          | (((x) & 0x0000ff0000000000ull) >> 24)
> -          | (((x) & 0x000000ff00000000ull) >> 8)
> -          | (((x) & 0x00000000ff000000ull) << 8)
> -          | (((x) & 0x0000000000ff0000ull) << 24)
> -          | (((x) & 0x000000000000ff00ull) << 40)
> -          | (((x) & 0x00000000000000ffull) << 56));
> -#endif
> +# else
> +  return (  (x & 0xff00000000000000) >> 56
> +          | (x & 0x00ff000000000000) >> 40
> +          | (x & 0x0000ff0000000000) >> 24
> +          | (x & 0x000000ff00000000) >>  8
> +          | (x & 0x00000000ff000000) <<  8
> +          | (x & 0x0000000000ff0000) << 24
> +          | (x & 0x000000000000ff00) << 40
> +          | (x & 0x00000000000000ff) << 56);
> +# endif
>  }
> +#endif

I think this produces wrong code with gcc 4.4.7 and older. See:

-------------------------- foo.c --------------------------
unsigned long long x = 0xff00000000000000;
-----------------------------------------------------------

$ gcc -Wall -S foo.c
foo.c:1: warning: integer constant is too large for ‘long’ type

Bruno




Reply via email to