[flac-dev] Please test new endian stuff

Erik de Castro Lopo mle+la at mega-nerd.com
Sun Feb 5 12:25:39 PST 2012


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
http://www.mega-nerd.com/


More information about the flac-dev mailing list