From: Alex M. <al...@us...> - 2006-04-22 23:31:37
|
Update of /cvsroot/gmpy/gmpy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17658/src Modified Files: gmpy.c Log Message: Fix setup.py for GMP 4.2 install on MacOSX 10.4 (look in /usr/local if needed); fix gmpy.c's randoms to be backwards compatible despite 4.2's changes to randoms; tweak tests to not demand quite as much identical-precision (digit by digit) of large numbers, since some last few digits change from GMP 4.1 to GMP 4.2; accept 4.2 among the GMP versions deemed OK in _test_cvr. Index: gmpy.c =================================================================== RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** gmpy.c 22 Apr 2006 16:28:19 -0000 1.23 --- gmpy.c 22 Apr 2006 23:31:30 -0000 1.24 *************** *** 5287,5290 **** --- 5287,5307 ---- static int randinited=0; static int randquality=0; + #if (__GNU_MP_VERSION==4) && (__GNU_MP_VERSION_MINOR>=2) + # define do_randinit(state, size) gmp_randinit_lc_2exp_size(state, size) + # define SEEDOF(x) ( *(mpz_t*)((x)->_mp_seed->_mp_d) ) + #else + # define do_randinit(state, size) gmp_randinit(state, GMP_RAND_ALG_LC, size) + # if (__GNU_MP_VERSION==4) + # define SEEDOF(x) ((x)->_mp_seed) + # else + # define SEEDOF(x) ((x)->seed) + # endif + #endif + + #if __GNU_MP__ >= 4 + #else + #endif + + static int randbits(PyObject* arg) { *************** *** 5301,5305 **** if(randinited) gmp_randclear(randstate); ! gmp_randinit(randstate, GMP_RAND_ALG_LC, size); randquality = size; randinited = 1; --- 5318,5322 ---- if(randinited) gmp_randclear(randstate); ! do_randinit(randstate, size); randquality = size; randinited = 1; *************** *** 5382,5390 **** PympzObject *resob = Pympz_new(); if(resob) { ! #if __GNU_MP__ >= 4 ! mpz_set(resob->z, randstate->_mp_seed); ! #else ! mpz_set(resob->z, randstate->seed); ! #endif result = (PyObject*)resob; } --- 5399,5403 ---- PympzObject *resob = Pympz_new(); if(resob) { ! mpz_set(resob->z, SEEDOF(randstate)); result = (PyObject*)resob; } |