[flac-dev] Please test new endian stuff

Erik de Castro Lopo
Sun, 05 Feb 2012 20:25:39 -0000

Ralph Giles wrote:

> On 5 February 2012 01:41, Erik de Castro Lopo <mle+la at
mega-nerd.com> wrote:
>
> > ?a) On Linux, use the bswap_*() intrinsic.
>
> FWIW, Both Apple llvm-gcc 4.2.1 and Apple clang 3.0 support
> __builtin_bswap32() At least on XCode 4.2. It compiles to the bswap
> instruction.

Ok, I have an M4 macro to detect the presence of __builtin_bswap32()
and I've tested it on BE and LE linux.

The scheme now is:

  a) Use __builtin_bswap32() where present (should be all versions of
     GCC and Clang).

  b) Use _byteswap_ulong() under MSVC.

  c) Use bwap32() if <byteswap.h> is present.

  d) Fall back to a macro.

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo