summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-10-17 21:52:17 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-10-17 21:52:17 (GMT)
commit743e0cd6b5d59767aae2524700857f188ca1e80e (patch)
tree89897c0424a3b361e04d451e2b3a64e5c7c17756 /Include
parent1e9af84e2ef41115dd07d00b57e5a2a7041bfeed (diff)
downloadcpython-743e0cd6b5d59767aae2524700857f188ca1e80e.zip
cpython-743e0cd6b5d59767aae2524700857f188ca1e80e.tar.gz
cpython-743e0cd6b5d59767aae2524700857f188ca1e80e.tar.bz2
Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified
endianess detection and handling.
Diffstat (limited to 'Include')
-rw-r--r--Include/pyport.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index 284e6da..baa04fe 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -865,4 +865,18 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);
#endif
#endif
+/*
+ * Convenient macros to deal with endianess of the platform. WORDS_BIGENDIAN is
+ * detected by configure and defined in pyconfig.h. The code in pyconfig.h
+ * also also takes care of Apple's universal builds.
+ */
+
+#ifdef WORDS_BIGENDIAN
+#define PY_BIG_ENDIAN 1
+#define PY_LITTLE_ENDIAN 0
+#else
+#define PY_BIG_ENDIAN 0
+#define PY_LITTLE_ENDIAN 1
+#endif
+
#endif /* Py_PYPORT_H */