]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
add Py_CHARMASK
authorGuido van Rossum <guido@python.org>
Fri, 10 Feb 1995 16:51:02 +0000 (16:51 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 10 Feb 1995 16:51:02 +0000 (16:51 +0000)
Include/allobjects.h

index 5ce324d2e97a1f18dbf1d505db565c3396dc2f5c..34b3816b5b6ff3184b60b312e70aaa693ff87bf9 100644 (file)
@@ -82,6 +82,14 @@ extern void Py_FatalError Py_PROTO((char *));
 #define PyArg_GetInt(v, a)     PyArg_Parse((v), "i", (a))
 #define PyArg_NoArgs(v)                PyArg_Parse(v, "")
 
+/* Convert a possibly signed character to a nonnegative int */
+/* XXX This assumes characters are 8 bits wide */
+#ifdef __CHAR_UNSIGNED__
+#define Py_CHARMASK(c)         (c)
+#else
+#define Py_CHARMASK(c)         ((c) & 0xff)
+#endif
+
 #ifdef __cplusplus
 }
 #endif