summaryrefslogtreecommitdiffstats
path: root/Include/code.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-09-11 10:48:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-09-11 10:48:15 (GMT)
commitab8740058a7f76f1438dc18a2ffd918da4f8118d (patch)
treef4c763c6e8f6281255b326a17eaaae2c1b237e73 /Include/code.h
parentbdb847ae99512e0985e1a3e955c90e23d36f8804 (diff)
downloadcpython-ab8740058a7f76f1438dc18a2ffd918da4f8118d.zip
cpython-ab8740058a7f76f1438dc18a2ffd918da4f8118d.tar.gz
cpython-ab8740058a7f76f1438dc18a2ffd918da4f8118d.tar.bz2
Issue #27129: Replaced wordcode related magic constants with macros.
Diffstat (limited to 'Include/code.h')
-rw-r--r--Include/code.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Include/code.h b/Include/code.h
index 9823f10..0619029 100644
--- a/Include/code.h
+++ b/Include/code.h
@@ -7,6 +7,16 @@
extern "C" {
#endif
+typedef uint16_t _Py_CODEUNIT;
+
+#ifdef WORDS_BIGENDIAN
+# define _Py_OPCODE(word) ((word) >> 8)
+# define _Py_OPARG(word) ((word) & 255)
+#else
+# define _Py_OPCODE(word) ((word) & 255)
+# define _Py_OPARG(word) ((word) >> 8)
+#endif
+
/* Bytecode object */
typedef struct {
PyObject_HEAD