diff options
| author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-17 12:56:29 +0200 |
|---|---|---|
| committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-17 12:56:29 +0200 |
| commit | 29b67bd25a1b781749bea5e22e80dcbe41f05dec (patch) | |
| tree | 6b8cb29b82b6890ac5f98c25fdf45878e9cd86fb /Modules/_struct.c | |
| parent | b5477a0109194b7c8500037e063bfd29dca03391 (diff) | |
| parent | 444b8a182b5a690fdb3e4d28ca8a61de27949178 (diff) | |
| download | cpython-29b67bd25a1b781749bea5e22e80dcbe41f05dec.tar.gz | |
Merge updates about dir() with 3.3.
Diffstat (limited to 'Modules/_struct.c')
| -rw-r--r-- | Modules/_struct.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c index 0cd0512dcf..6e8759bebb 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1199,12 +1199,11 @@ whichtable(char **pfmt) case '!': /* Network byte order is big-endian */ return bigendian_table; case '=': { /* Host byte order -- different from native in alignment! */ - int n = 1; - char *p = (char *) &n; - if (*p == 1) - return lilendian_table; - else - return bigendian_table; +#if PY_LITTLE_ENDIAN + return lilendian_table; +#else + return bigendian_table; +#endif } default: --*pfmt; /* Back out of pointer increment */ @@ -2098,13 +2097,13 @@ PyInit__struct(void) /* Check endian and swap in faster functions */ { - int one = 1; formatdef *native = native_table; formatdef *other, *ptr; - if ((int)*(unsigned char*)&one) - other = lilendian_table; - else - other = bigendian_table; +#if PY_LITTLE_ENDIAN + other = lilendian_table; +#else + other = bigendian_table; +#endif /* Scan through the native table, find a matching entry in the endian table and swap in the native implementations whenever possible |
