Endian Macros - are there any defaults

Stan Katz Stan.Katz@ctc-control.com
Fri Nov 12 20:54:00 GMT 2004


Daniel Kegel wrote:
>Stan Katz wrote:
>> I know that gcc defines some preprocessor macros that let the
>> preprocessor generate different code for different architectures (I'm
>> using some of them) but I can't seem to find any that tell me about
>> either data format (big or little endian) or invocation options. Does
>> anyone know of anything I can use.
>
>#include <endian.h>
>
>#if __BYTE_ORDER == __LITTLE_ENDIAN
>...
>#elif __BYTE_ORDER == __BIG_ENDIAN
>...
>#endif
>
>bits/endian.h is where __BYTE_ORDER is ultimately defined.

I can't find any endian.h file on my system, that may be because
unfortunately I'm using newlib hosted on Cygwin but the file isn't part
of either gcc 2.95.2, 3.1 or 3.2 or Newlib 1.8.0 or 1.12.0 for either
ARM or SH (or for Cygwin).

Thanks - it would have been nice if I had found the file, embarrassing,
but nice.

Stan

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list