Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10929
-gerrit
commit f45c9c71cd0b664ca515f4950d70a2ea5c8867cc Author: Sol Boucher solb@chromium.org Date: Thu May 7 21:00:05 2015 -0700
cbfstool: move bit swapping macros to swab.h
Change-Id: Id22232c45225011951e01c370e0f473af574d758 Signed-off-by: Sol Boucher solb@chromium.org Signed-off-by: Patrick Georgi pgeorgi@chromium.org Original-Change-Id: I1a117a9473e895feaf455bb30d0f945f57de51eb Original-Signed-off-by: Sol Boucher solb@chromium.org --- util/cbfstool/common.h | 9 --------- util/cbfstool/swab.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h index 06ee00b..5fb1906 100644 --- a/util/cbfstool/common.h +++ b/util/cbfstool/common.h @@ -28,15 +28,6 @@
/* Endianess */ #include "swab.h" -#if !defined(__APPLE__) && !defined(__NetBSD__) -#define ntohl(x) (is_big_endian() ? (uint32_t)(x) : swab32(x)) -#define htonl(x) (is_big_endian() ? (uint32_t)(x) : swab32(x)) -#elif defined(__NetBSD__) -#include <arpa/inet.h> -#endif -#define ntohll(x) (is_big_endian() ? (uint64_t)(x) : swab64(x)) -#define htonll(x) (is_big_endian() ? (uint64_t)(x) : swab64(x)) -int is_big_endian(void);
/* Message output */ extern int verbose; diff --git a/util/cbfstool/swab.h b/util/cbfstool/swab.h index c5e4370..22ae8b4 100644 --- a/util/cbfstool/swab.h +++ b/util/cbfstool/swab.h @@ -15,6 +15,15 @@ * */
+#if !defined(__APPLE__) && !defined(__NetBSD__) +#define ntohl(x) (is_big_endian() ? (uint32_t)(x) : swab32(x)) +#define htonl(x) (is_big_endian() ? (uint32_t)(x) : swab32(x)) +#elif defined(__NetBSD__) +#include <arpa/inet.h> +#endif +#define ntohll(x) (is_big_endian() ? (uint64_t)(x) : swab64(x)) +#define htonll(x) (is_big_endian() ? (uint64_t)(x) : swab64(x)) + /* casts are necessary for constants, because we never know how for sure * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. */ @@ -41,4 +50,7 @@ (((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ (((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) ))
+/* common.c */ +int is_big_endian(void); + #endif /* _SWAB_H */