This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: Endian Macros - are there any defaults


 

	Daniel Kegel wrote:
	

	>http://www.unixpapa.com/incnote/byteorder.html suggests that <sys/param.h> is a more
	>portable place to get that info.
	>
	>In fact, newlib itself gets it from <sys/param.h> when building iconv!
	><machine/endian.h> is where BYTE_ORDER is ultimately defined on newlib,
	>but you should not include that directly.
	>
	
	snip
	 
	>I suspect something like the following, or maybe without underscores, would
	>work on both newlib and glibc:
	>
	>#include <sys/types.h>
	>#include <sys/param.h>
	>#if __BYTE_ORDER == __LITTLE_ENDIAN
	>...
	>#elif __BYTE_ORDER == __BIG_ENDIAN
	>...
	>#endif
	>
	>Let us know what you find out.  I've never used newlib myself.
	>- Dan
	
	Thanks - it was in sys/param.h and I also found the target specific (for arm at least)
	compiler defined macro that is set when big-endian is selected.
	 
	Stan Katz


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