summaryrefslogtreecommitdiffstats
path: root/Objects/stringlib/codecs.h
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 /Objects/stringlib/codecs.h
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 'Objects/stringlib/codecs.h')
-rw-r--r--Objects/stringlib/codecs.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/stringlib/codecs.h b/Objects/stringlib/codecs.h
index 2a01089..cbf3508 100644
--- a/Objects/stringlib/codecs.h
+++ b/Objects/stringlib/codecs.h
@@ -47,7 +47,7 @@ STRINGLIB(utf8_decode)(const char **inptr, const char *end,
unsigned long value = *(unsigned long *) _s;
if (value & ASCII_CHAR_MASK)
break;
-#ifdef BYTEORDER_IS_LITTLE_ENDIAN
+#if PY_LITTLE_ENDIAN
_p[0] = (STRINGLIB_CHAR)(value & 0xFFu);
_p[1] = (STRINGLIB_CHAR)((value >> 8) & 0xFFu);
_p[2] = (STRINGLIB_CHAR)((value >> 16) & 0xFFu);
@@ -454,7 +454,7 @@ STRINGLIB(utf16_decode)(const unsigned char **inptr, const unsigned char *e,
const unsigned char *q = *inptr;
STRINGLIB_CHAR *p = dest + *outpos;
/* Offsets from q for retrieving byte pairs in the right order. */
-#ifdef BYTEORDER_IS_LITTLE_ENDIAN
+#if PY_LITTLE_ENDIAN
int ihi = !!native_ordering, ilo = !native_ordering;
#else
int ihi = !native_ordering, ilo = !!native_ordering;
@@ -485,7 +485,7 @@ STRINGLIB(utf16_decode)(const unsigned char **inptr, const unsigned char *e,
block = SWAB(block);
#endif
}
-#ifdef BYTEORDER_IS_LITTLE_ENDIAN
+#if PY_LITTLE_ENDIAN
# if SIZEOF_LONG == 4
p[0] = (STRINGLIB_CHAR)(block & 0xFFFFu);
p[1] = (STRINGLIB_CHAR)(block >> 16);