diff Modules/_struct.c @ 41526:708c8c5fc173 legacy-trunk

Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
author Kristján Valur Jónsson <kristjan@ccpgames.com>
date Wed, 25 Apr 2007 00:17:39 +0000
parents 80ff75fa2754
children ec83d21065aa
line wrap: on
line diff
--- a/Modules/_struct.c	Wed Apr 25 00:10:50 2007 +0000
+++ b/Modules/_struct.c	Wed Apr 25 00:17:39 2007 +0000
@@ -849,7 +849,7 @@
 	} while (--i > 0);
 	/* Extend the sign bit. */
 	if (SIZEOF_LONG_LONG > f->size)
-		x |= -(x & (1L << ((8 * f->size) - 1)));
+		x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1)));
 	if (x >= LONG_MIN && x <= LONG_MAX)
 		return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
 	return PyLong_FromLongLong(x);
@@ -1085,7 +1085,7 @@
 	} while (i > 0);
 	/* Extend the sign bit. */
 	if (SIZEOF_LONG_LONG > f->size)
-		x |= -(x & (1L << ((8 * f->size) - 1)));
+		x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1)));
 	if (x >= LONG_MIN && x <= LONG_MAX)
 		return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
 	return PyLong_FromLongLong(x);