summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authork3it <gokoyev@gmail.com>2018-12-02 21:23:23 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2018-12-03 10:23:23 +0800
commit5e6bf06e5b83c9eaa119dae029c4bf191ee094c4 (patch)
tree2ca232e2149bc5814be6c6fb7a73a63001d73577
parent6a5b785fdf6b0671d8827793daee9c0b77dae25e (diff)
downloadpy-bcrypt-git-5e6bf06e5b83c9eaa119dae029c4bf191ee094c4.tar.gz
add AIX platform support to portable_endian.h (#159)
-rw-r--r--src/_csrc/portable_endian.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/_csrc/portable_endian.h b/src/_csrc/portable_endian.h
index 99c487e..166247c 100644
--- a/src/_csrc/portable_endian.h
+++ b/src/_csrc/portable_endian.h
@@ -180,6 +180,35 @@
# define be64toh(x) BE_64(x)
# define le64toh(x) LE_64(x)
+#elif defined _AIX /* AIX is always big endian */
+# define be64toh(x) (x)
+# define be32toh(x) (x)
+# define be16toh(x) (x)
+# define le32toh(x) \
+ ((((x) & 0xff) << 24) | \
+ (((x) & 0xff00) << 8) | \
+ (((x) & 0xff0000) >> 8) | \
+ (((x) & 0xff000000) >> 24))
+# define le64toh(x) \
+ ((((x) & 0x00000000000000ffL) << 56) | \
+ (((x) & 0x000000000000ff00L) << 40) | \
+ (((x) & 0x0000000000ff0000L) << 24) | \
+ (((x) & 0x00000000ff000000L) << 8) | \
+ (((x) & 0x000000ff00000000L) >> 8) | \
+ (((x) & 0x0000ff0000000000L) >> 24) | \
+ (((x) & 0x00ff000000000000L) >> 40) | \
+ (((x) & 0xff00000000000000L) >> 56))
+# ifndef htobe64
+# define htobe64(x) be64toh(x)
+# endif
+# ifndef htobe32
+# define htobe32(x) be32toh(x)
+# endif
+# ifndef htobe16
+# define htobe16(x) be16toh(x)
+# endif
+
+
#else
# error platform not supported