Build wallet with Android NDK

This commit is contained in:
MoroccanMalinois 2017-01-05 01:11:05 +00:00
parent dd580d7bc7
commit 80abc3bc4a
10 changed files with 103 additions and 8 deletions

View file

@ -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))