Index: Modules/_ctypes/cfield.c =================================================================== --- Modules/_ctypes/cfield.c (revision 85158) +++ Modules/_ctypes/cfield.c (working copy) @@ -428,11 +428,11 @@ #define LOW_BIT(x) ((x) & 0xFFFF) #define NUM_BITS(x) ((x) >> 16) -/* This seems nore a compiler issue than a Windows/non-Windows one */ -#ifdef MS_WIN32 -# define BIT_MASK(size) ((1 << NUM_BITS(size))-1) +/* XXX: 0 must be maximum size integer on the platform */ +#ifdef HAVE_LONG_LONG +# define BIT_MASK(size) (~((~Py_ULL(0)) << NUM_BITS(size))) #else -# define BIT_MASK(size) ((1LL << NUM_BITS(size))-1) +# define BIT_MASK(size) (~((~0UL) << NUM_BITS(size))) #endif /* This macro CHANGES the first parameter IN PLACE. For proper sign handling,