aboutsummaryrefslogtreecommitdiff
path: root/src/common/int-util.h
diff options
context:
space:
mode:
authorMoroccanMalinois <MoroccanMalinois@protonmail.com>2017-01-05 01:11:05 +0000
committerMoroccanMalinois <MoroccanMalinois@protonmail.com>2017-01-05 01:11:05 +0000
commit80abc3bc4a73f3ba6ffd40b1a03de0cc4d01e3c9 (patch)
tree5b9f6c810e59d36607590a6e736858a7d7d3bf7f /src/common/int-util.h
parentMerge pull request #1487 (diff)
downloadmonero-80abc3bc4a73f3ba6ffd40b1a03de0cc4d01e3c9.tar.xz
Build wallet with Android NDK
Diffstat (limited to '')
-rw-r--r--src/common/int-util.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/common/int-util.h b/src/common/int-util.h
index e9eddee9c..9ac20e582 100644
--- a/src/common/int-util.h
+++ b/src/common/int-util.h
@@ -36,6 +36,10 @@
#include <string.h>
#include <sys/param.h>
+#if defined(__ANDROID__)
+#include <byteswap.h>
+#endif
+
#if defined(_MSC_VER)
#include <stdlib.h>
@@ -138,16 +142,24 @@ static inline uint32_t ident32(uint32_t x) { return x; }
static inline uint64_t ident64(uint64_t x) { return x; }
#ifndef __OpenBSD__
+# if defined(__ANDROID__) && defined(__swap32) && !defined(swap32)
+# define swap32 __swap32
+# elif !defined(swap32)
static inline uint32_t swap32(uint32_t x) {
x = ((x & 0x00ff00ff) << 8) | ((x & 0xff00ff00) >> 8);
return (x << 16) | (x >> 16);
}
+# endif
+# if defined(__ANDROID__) && defined(__swap64) && !defined(swap64)
+# define swap64 __swap64
+# elif !defined(swap64)
static inline uint64_t swap64(uint64_t x) {
x = ((x & 0x00ff00ff00ff00ff) << 8) | ((x & 0xff00ff00ff00ff00) >> 8);
x = ((x & 0x0000ffff0000ffff) << 16) | ((x & 0xffff0000ffff0000) >> 16);
return (x << 32) | (x >> 32);
}
-#endif
+# endif
+#endif /* __OpenBSD__ */
#if defined(__GNUC__)
#define UNUSED __attribute__((unused))