summaryrefslogtreecommitdiffstats
path: root/include/gmputil.h
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2014-04-12 10:40:08 +0200
committerPatrick McHardy <kaber@trash.net>2014-04-12 10:55:26 +0200
commite4645012a69a36588886c6af87fb5a2b49834869 (patch)
tree8c0b3957a181184c90b0e6ca3cd432178d95d08e /include/gmputil.h
parent5259feeb7cda089523a2196248baa5395bce4b50 (diff)
gmputil: use MSF/LSF in import/export functions dependant on host byte order
For data of byteorder BYTEORDER_HOST_ENDIAN we need to set the word order dependant on the host byte order. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/gmputil.h')
-rw-r--r--include/gmputil.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/gmputil.h b/include/gmputil.h
index 88be697a..63eb0ba9 100644
--- a/include/gmputil.h
+++ b/include/gmputil.h
@@ -2,12 +2,21 @@
#define NFTABLES_GMPUTIL_H
#include <gmp.h>
+#include <asm/byteorder.h>
enum mpz_word_order {
MPZ_MSWF = 1,
MPZ_LSWF = -1,
};
+#ifdef __LITTLE_ENDIAN_BITFIELD
+#define MPZ_HWO MPZ_LSWF
+#elif defined(__BIG_ENDIAN_BITFIELD)
+#define MPZ_HWO MPZ_MSWF
+#else
+#error "byteorder undefined"
+#endif
+
enum mpz_byte_order {
MPZ_BIG_ENDIAN = 1,
MPZ_HOST_ENDIAN = 0,