Skip to content

Commit

Permalink
endian: Minimize use of hand-crafted endian checks.
Browse files Browse the repository at this point in the history
Use endian.h if it exists..guess on other platforms.
This should help cross-compiling, but might not fix it
in all cases.

Signed-off-by: Ben Greear <greearb@candelatech.com>
  • Loading branch information
greearb committed Aug 17, 2010
1 parent 904d973 commit 42136cf
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 417 deletions.
370 changes: 0 additions & 370 deletions xorp/fea/ip.h

This file was deleted.

10 changes: 3 additions & 7 deletions xorp/libxorp/utility.h
Expand Up @@ -21,10 +21,6 @@
* http://xorp.net
*/

/*
* $XORP: xorp/libxorp/utility.h,v 1.21 2008/10/02 21:57:36 bms Exp $
*/

#ifndef __LIBXORP_UTILITY_H__
#define __LIBXORP_UTILITY_H__

Expand Down Expand Up @@ -143,14 +139,14 @@ sockaddr_storage2sockaddr(struct sockaddr_storage* ss)
* CPU instructions, whereas the macro below can be handled by the
* compiler front-end for literal values.
*/
#if defined(WORDS_BIGENDIAN)
#if __BYTE_ORDER == __BIG_ENDIAN
# define htonl_literal(x) (x)
#elif defined(WORDS_SMALLENDIAN)
#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define htonl_literal(x) \
((((x) & 0x000000ffU) << 24) | (((x) & 0x0000ff00U) << 8) | \
(((x) & 0x00ff0000U) >> 8) | (((x) & 0xff000000U) >> 24))
#else
# error "Missing endian definition from config.h"
# error "Endian detection is broken."
#endif

/*
Expand Down

0 comments on commit 42136cf

Please sign in to comment.