From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Larmour To: "Edward, Yan-Chi, Lin" Cc: Ecos-Discuss Subject: Re: [ECOS] How do I get __ARMEB__ defined ? Date: Mon, 11 Dec 2000 13:36:00 -0000 Message-id: <3A3548A2.9D5531CC@redhat.com> References: X-SW-Source: 2000-12/msg00233.html "Edward,Yan-Chi,Lin" wrote: > > Hi > > I have a bigendian ARM cpu now, but I don't know how do I get __ARMEB__ defined ? It's defined by the compiler when it is invoked with -EB (for big-endian). > Also could someone explain what does the macro in hal_io.h for big endian means ? > Why ^3 ? Because the change of endian-ness means that for the code to read the same byte when given the same address irrespective of endianness, then the last two bits of the address need fiddling to compensate for the endianness change. e.g. if asking for the lowest significant byte, the address supplied would end in 00, but for this macro to return the correct byte in big-endian mode, it has to read 11. Similarly 01->10 and 11->00, so the operation is a bitwise XOR. Jifl -- Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS Tel: +44 (1223) 728762 "Plan to be spontaneous tomorrow." || These opinions are all my own fault