[PATCH] byteorder: do not assume PowerPC is big-endian
cs at samba.org
Mon May 5 15:05:07 MDT 2014
On Mon, May 05, 2014 at 07:01:18PM +0200, David Disseldorp wrote:
> Hi Christof,
> On Mon, 5 May 2014 09:17:12 -0700, Christof Schmitt wrote:
> > i saw the bugzilla review request. Without having access to a power
> > system, i can only review the code. It looks correct, but i saw that
> > there is already a endianess check in buildtools/wafsamba/wscript:
> > conf.CHECK_CODE('long one = 1; return ((char *)(&one))',
> > execute=True,
> > define='WORDS_BIGENDIAN')
> > You could use the WORDS_BIGENDIAN define instead of importing ccan. Of
> > course, it the longterm it would be good to only have one endianess
> > check, maybe the ccan one.
> Thanks for the pointer, I hadn't come across that check.
> My preference would still be to continue to use the lib/ccan/wscript
> endianness checks, as they first use the __BYTE_ORDER, __BIG_ENDIAN and
> __LITTLE_ENDIAN definitions before doing the runtime test. They also
> fail if endianness can't be determined.
After looking into this again, i agree that the ccan check looks better.
It also seems that you don't need the include for the endian.h. The
HAVE_BIG_ENDIAN is defined globally from wscript, so it is always
Reviewed-by: Christof Schmitt <cs at samba.org>
for your patch without the include.
A follow-on patch could convert more places to use
More information about the samba-technical