summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanek Duvall <duvall@comfychair.org>2017-02-16 16:43:54 -0800
committerPaul Kehrer <paul.l.kehrer@gmail.com>2017-02-16 18:43:54 -0600
commit36d6af6a5e96765f58cacb54159ddf8c17456c17 (patch)
tree224ef44856eb0820e5d401d58f1787aaf0ad5eb2
parent4b8c73ac78d5224b89db1ab97f192271e857b703 (diff)
downloadpy-bcrypt-git-36d6af6a5e96765f58cacb54159ddf8c17456c17.tar.gz
Define types and byte-order macros for Solaris. (#106)
-rw-r--r--src/_csrc/portable_endian.h19
-rw-r--r--src/_csrc/pycabcrypt.h5
2 files changed, 24 insertions, 0 deletions
diff --git a/src/_csrc/portable_endian.h b/src/_csrc/portable_endian.h
index 4816331..99c487e 100644
--- a/src/_csrc/portable_endian.h
+++ b/src/_csrc/portable_endian.h
@@ -161,6 +161,25 @@
# define __LITTLE_ENDIAN LITTLE_ENDIAN
# define __PDP_ENDIAN PDP_ENDIAN
+#elif defined(__sun)
+
+# include <sys/byteorder.h>
+
+# define htobe16(x) BE_16(x)
+# define htole16(x) LE_16(x)
+# define be16toh(x) BE_16(x)
+# define le16toh(x) LE_16(x)
+
+# define htobe32(x) BE_32(x)
+# define htole32(x) LE_32(x)
+# define be32toh(x) BE_32(x)
+# define le32toh(x) LE_32(x)
+
+# define htobe64(x) BE_64(x)
+# define htole64(x) LE_64(x)
+# define be64toh(x) BE_64(x)
+# define le64toh(x) LE_64(x)
+
#else
# error platform not supported
diff --git a/src/_csrc/pycabcrypt.h b/src/_csrc/pycabcrypt.h
index c1a8422..b71f577 100644
--- a/src/_csrc/pycabcrypt.h
+++ b/src/_csrc/pycabcrypt.h
@@ -14,6 +14,11 @@ typedef unsigned long long uint64_t;
typedef uint64_t u_int64_t;
#define snprintf _snprintf
#define __attribute__(unused)
+#elif defined(__sun)
+typedef uint8_t u_int8_t;
+typedef uint16_t u_int16_t;
+typedef uint32_t u_int32_t;
+typedef uint64_t u_int64_t;
#else
#include <stdint.h>
#endif