[Python-checkins] CVS: python/dist/src/Modules mpzmodule.c,2.34,2.34.2.1

Moshe Zadka moshez@users.sourceforge.net
2001年3月31日 02:55:49 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv23401/Modules
Modified Files:
 Tag: release20-maint
	mpzmodule.c 
Log Message:
Make mpz's .binary() work on 64 bit platforms
Make mpzmodule compile with cygwin
Index: mpzmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/mpzmodule.c,v
retrieving revision 2.34
retrieving revision 2.34.2.1
diff -C2 -r2.34 -r2.34.2.1
*** mpzmodule.c	2000年10月11日 21:53:34	2.34
--- mpzmodule.c	2001年03月31日 10:55:47	2.34.2.1
***************
*** 1478,1481 ****
--- 1478,1487 ----
 		*cp++ = (unsigned char)((ldigit >>= 8) & 0xFF);
 		*cp++ = (unsigned char)((ldigit >>= 8) & 0xFF);
+ 		if (sizeof(ldigit) == 8 && BITS_PER_MP_LIMB == 64) {
+ 			*cp++ = (unsigned char)((ldigit >>= 8) & 0xFF);
+ 			*cp++ = (unsigned char)((ldigit >>= 8) & 0xFF);
+ 			*cp++ = (unsigned char)((ldigit >>= 8) & 0xFF);
+ 			*cp++ = (unsigned char)((ldigit >>= 8) & 0xFF);
+ 		}
 	}
 
***************
*** 1585,1589 ****
 
 static PyTypeObject MPZtype = {
! 	PyObject_HEAD_INIT(&PyType_Type)
 	0,			/*ob_size*/
 	"mpz",			/*tp_name*/
--- 1591,1595 ----
 
 static PyTypeObject MPZtype = {
! 	PyObject_HEAD_INIT(NULL)
 	0,			/*ob_size*/
 	"mpz",			/*tp_name*/
***************
*** 1717,1720 ****
--- 1723,1727 ----
 
 	mp_set_memory_functions( mp_allocate, mp_reallocate, mp_free );
+ MPZtype.ob_type = &PyType_Type;
 	module = Py_InitModule("mpz", mpz_functions);
 

AltStyle によって変換されたページ (->オリジナル) /