Skip to content

Commit

Permalink
bsd/endian: Fix up endian logic for systems that don't have <endian.h>
Browse files Browse the repository at this point in the history
Looks like BSD has <sys/endian.h>, will try to enable that next, but we
still need these fixes for systems w/out endian.h

Signed-off-by: Ben Greear <greearb@v-freebsd.candelatech.com>
  • Loading branch information
Ben Greear committed Aug 17, 2010
1 parent 42136cf commit 08c5d35
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions xorp/libxorp/xorp.h
Expand Up @@ -32,6 +32,7 @@

#ifndef BYTE_ORDER
#ifdef __BYTE_ORDER
#warning "__BYTE_ORDER is defined."
#define BYTE_ORDER __BYTE_ORDER
#define LITTLE_ENDIAN __LITTLE_ENDIAN
#define BIG_ENDIAN __BIG_ENDIAN
Expand All @@ -42,17 +43,28 @@
* Presume that the scons logic figured defined WORDS_BIGENDIAN
* or not.
*/

#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN 1234
#endif
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN 4321
#endif

#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#define LITTLE_ENDIAN __LITTLE_ENDIAN
#endif
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#define BIG_ENDIAN __BIG_ENDIAN
#endif


#ifdef WORDS_BIGENDIAN
#define BYTE_ORDER BIG_ENDIAN
#define __BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#define __BYTE_ORDER LITTLE_ENDIAN
#endif

/*
Expand Down

0 comments on commit 08c5d35

Please sign in to comment.