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: BZ#13926: Add __bswap_64 for non-GCC compilers


On Wed, Mar 28, 2012 at 04:51:00PM +0200, Andreas Jaeger wrote:
> +#else
> +# define __bswap_constant_64(x) \
> +     ((((x) & 0xff00000000000000ul) >> 56)				      \
> +      | (((x) & 0x00ff000000000000ul) >>  40)				      \
> +      | (((x) & 0x0000ff0000000000ul) >> 24)				      \
> +      | (((x) & 0x000000ff00000000ul) >> 8)				      \
> +      | (((x) & 0x00000000ff000000ul) << 8)				      \
> +      | (((x) & 0x0000000000ff0000ul) << 24)				      \
> +      | (((x) & 0x000000000000ff00ul) << 40)				      \
> +      | (((x) & 0x00000000000000fful) << 56))
> +
> +static __inline unsigned long long int
> +__bswap_64 (unsigned long long int __bsx)
> +{
> +  return __bswap_constant_64 (__bsx);
> +}

How do you know that the non-GCC compiler in question supports
unsigned long long type at all?  It is not a standard C89 type...
Why are you using ul rather than ull suffixed constants?

	Jakub


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