]> granicus.if.org Git - python/commitdiff
Fix the bitfield test when _ctypes is compiled with MingW. Structures
authorThomas Heller <theller@ctypes.org>
Wed, 5 Jul 2006 09:13:56 +0000 (09:13 +0000)
committerThomas Heller <theller@ctypes.org>
Wed, 5 Jul 2006 09:13:56 +0000 (09:13 +0000)
containing bitfields may have different layout on MSVC and MingW .

Modules/_ctypes/cfield.c

index 68fac67003c8bc8d37756a07081b3b52c0f5ec15..c5895f095e8df7e653366887116c95726c0fedd4 100644 (file)
@@ -65,10 +65,10 @@ CField_FromDesc(PyObject *desc, int index,
        }
        if (bitsize /* this is a bitfield request */
            && *pfield_size /* we have a bitfield open */
-#ifdef MS_WIN32
+#if defined(MS_WIN32) && !defined(__MINGW32__)
            && dict->size * 8 == *pfield_size /* MSVC */
 #else
-           && dict->size * 8 <= *pfield_size /* GCC */
+           && dict->size * 8 <= *pfield_size /* GCC, MINGW */
 #endif
            && (*pbitofs + bitsize) <= *pfield_size) {
                /* continue bit field */