1*122966f8Smrg2020-11-10 Marco Bodrato <bodrato@mail.dm.unipi.it> 2*122966f8Smrg 3*122966f8Smrg * tests/run-tests: Update WINEPATH, instead of overwriting it. 4*122966f8Smrg 5*122966f8Smrg2020-10-25 Marco Bodrato <bodrato@mail.dm.unipi.it> 6*122966f8Smrg 7*122966f8Smrg * mini-mpq.c (mpq_canonical_sign): Use the correct type for size. 8*122966f8Smrg 9*122966f8Smrg2020-10-18 Marco Bodrato <bodrato@mail.dm.unipi.it> 10*122966f8Smrg 11*122966f8Smrg * mini-mpq.c (mpq_out_str): Return 0 when base is out of range. 12*122966f8Smrg * mini-gmp.c (mpz_out_str): Likewise. (spotted by Paul Eggert) 13*122966f8Smrg 14*122966f8Smrg * tests/t-str.c: Test out-of-range bases for mpz_out_str. 15*122966f8Smrg * tests/t-mpq_str.c: Likewise, for mpq_out_str. 16*122966f8Smrg 17*122966f8Smrg2020-10-06 Niels Möller <nisse@lysator.liu.se> 18*122966f8Smrg 19*122966f8Smrg * tests/run-tests: Better support for make check on wine or cygwin. 20*122966f8Smrg 21*122966f8Smrg2020-09-10 Marco Bodrato <bodrato@mail.dm.unipi.it> 22*122966f8Smrg 23*122966f8Smrg * tests/t-mpq_double.c (mpq_get_d_exact_p): Cleanup. 24*122966f8Smrg 25*122966f8Smrg * mini-gmp.h: Update FILE tests from gmp-h (tx Vincent Lefèvre). 26*122966f8Smrg 27*122966f8Smrg2020-05-21 Torbjörn Granlund <tg@gmplib.org> 28*122966f8Smrg 29*122966f8Smrg * tests/t-mpq_muldiv_2exp.c (testmain): Cast printf args to right type. 30*122966f8Smrg 31*122966f8Smrg * tests/t-double.c: Provide default M_PI definition. 32*122966f8Smrg 33*122966f8Smrg2020-05-19 Torbjörn Granlund <tg@gmplib.org> 34*122966f8Smrg 35*122966f8Smrg * tests/hex-random.h (enum hex_random_op): Remove final ",". 36*122966f8Smrg 37*122966f8Smrg2019-12-04 Marco Bodrato <bodrato@mail.dm.unipi.it> 38*122966f8Smrg 39*122966f8Smrg * mini-gmp/mini-gmp.c (mpn_invert_3by2): Remove shortcuts. 40*122966f8Smrg 41*122966f8Smrg2019-11-19 Marco Bodrato <bodrato@mail.dm.unipi.it> 42*122966f8Smrg 43*122966f8Smrg * mini-gmp/mini-gmp.c (mpn_invert_3by2): Shortcut for short limbs. 44*122966f8Smrg 45*122966f8Smrg2019-11-09 Marco Bodrato <bodrato@mail.dm.unipi.it> 46*122966f8Smrg 47*122966f8Smrg * mini-gmp/mini-gmp.c (gmp_clz, gmp_popcount_limb, mpz_export): 48*122966f8Smrg Avoid undefined behaviour with small limb sizes. 49*122966f8Smrg 50*122966f8Smrg2019-09-30 Niels Möller <nisse@lysator.liu.se> 51*122966f8Smrg 52*122966f8Smrg * tests/t-gcd.c (gcdext_valid_p): Stricter checks for gcdext 53*122966f8Smrg corner cases. 54*122966f8Smrg 55*122966f8Smrg2018-12-21 Marco Bodrato <bodrato@mail.dm.unipi.it> 56*122966f8Smrg 57*122966f8Smrg * mini-gmp/mini-gmp.c: Support for micro-gmp. 58*122966f8Smrg 59*122966f8Smrg2018-11-07 Marco Bodrato <bodrato@mail.dm.unipi.it> 60*122966f8Smrg 61*122966f8Smrg * mini-gmp/mini-gmp.c: Silence a couple of warnings. 62*122966f8Smrg 63*122966f8Smrg2018-10-30 Marco Bodrato <bodrato@mail.dm.unipi.it> 64*122966f8Smrg 65*122966f8Smrg * mini-gmp.c (mpz_probab_prime_p): BPSW test for primality. 66*122966f8Smrg 67*122966f8Smrg * tests/hex-random.c (hex_random_lucm_op): New function. 68*122966f8Smrg * tests/hex-random.h: Declare it. 69*122966f8Smrg * tests/mini-random.c (mini_random_lucm_op): New function. 70*122966f8Smrg * tests/mini-random.h: Declare it. 71*122966f8Smrg * mini-gmp/tests/t-lucm.c: New test 72*122966f8Smrg * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Add t-lucm. 73*122966f8Smrg 74*122966f8Smrg2018-09-07 Niels Möller <nisse@lysator.liu.se> 75*122966f8Smrg 76*122966f8Smrg * tests/t-div.c (testmain): Add missing const declarations. 77*122966f8Smrg 78*122966f8Smrg2018-05-20 Marco Bodrato <bodrato@mail.dm.unipi.it> 79*122966f8Smrg 80*122966f8Smrg * mini-gmp.c (mpz_get_d): Convert a fixed number of 81*122966f8Smrg bits (GMP_DBL_MANT_BITS) to avoid rounding. 82*122966f8Smrg 83*122966f8Smrg * mini-mpq.c (mpq_mul): Use mpq_nan_init. 84*122966f8Smrg 85*122966f8Smrg * tests/t-double.c (test_matissa): Tests converted bits. 86*122966f8Smrg 87*122966f8Smrg2018-04-26 Marco Bodrato <bodrato@mail.dm.unipi.it> 88*122966f8Smrg 89*122966f8Smrg * mini-mpq.c: New file, mini-implementation of mpq_t. 90*122966f8Smrg * mini-mpq.h: New file, definitions for mpq_t. 91*122966f8Smrg * tests/t-mpq_addsub: New tests for mpq_add and sub. 92*122966f8Smrg * tests/t-mpq_muldiv: New tests for mpq_mul and div. 93*122966f8Smrg * tests/t-mpq_muldiv_2exp: New tests for mpq_*_2exp. 94*122966f8Smrg 95*122966f8Smrg2018-03-11 Niels Möller <nisse@lysator.liu.se> 96*122966f8Smrg 97*122966f8Smrg * mini-gmp.c (mpn_div_qr_2_preinv): Drop separate rp argument. 98*122966f8Smrg Clobber input np, and store remainder in np[0] and np[1]. This is 99*122966f8Smrg all the current caller needs, and it eliminates one allocation in 100*122966f8Smrg the common case of un-normalized d. 101*122966f8Smrg (mpn_div_qr_2): Delete #if:ed out function. 102*122966f8Smrg (mpn_div_qr_preinv): Update the only call site for 103*122966f8Smrg mpn_div_qr_2_preinv. 104*122966f8Smrg 105*122966f8Smrg2018-02-10 Niels Möller <nisse@lysator.liu.se> 106*122966f8Smrg 107*122966f8Smrg * mini-gmp.c (mpn_div_qr_1_preinv): When qp is non-NULL, reuse 108*122966f8Smrg area for shifted input, to avoid an allocation. 109*122966f8Smrg 110*122966f8Smrg2018-01-15 Marco Bodrato <bodrato@mail.dm.unipi.it> 111*122966f8Smrg 112*122966f8Smrg * mini-gmp.c (gmp_popcount_limb): Micro-optimisations. 113*122966f8Smrg * tests/t-comb.c (checkWilson): Check also mpz_2fac_ui. 114*122966f8Smrg 115*122966f8Smrg2017-12-30 Marco Bodrato <bodrato@mail.dm.unipi.it> 116*122966f8Smrg 117*122966f8Smrg * mini-gmp.c (mpz_mfac_ui, mpz_2fac_ui): New functions. 118*122966f8Smrg * mini-gmp.h: Declare them. 119*122966f8Smrg * mini-gmp.c (mpz_fac_ui): Use mpz_mfac_ui. 120*122966f8Smrg 121*122966f8Smrg2017-07-23 Niels Möller <nisse@lysator.liu.se> 122*122966f8Smrg 123*122966f8Smrg * mini-gmp.c (GMP_MPN_OVERLAP_P): New macro, copy of 124*122966f8Smrg MPN_OVERLAP_P, from gmp-impl.h. 125*122966f8Smrg (mpn_mul): Assert that output area doesn't overlap with the input. 126*122966f8Smrg 127*122966f8Smrg2017-02-03 Marco Bodrato <bodrato@mail.dm.unipi.it> 128*122966f8Smrg 129*122966f8Smrg * mini-gmp.c (mpz_sizeinbase, mpz_get_str, mpz_set_str): Support 130*122966f8Smrg bases up to 62. 131*122966f8Smrg * tests/t-str.c: Update tests accordingly. 132*122966f8Smrg 133*122966f8Smrg2016-11-27 Marco Bodrato <bodrato@mail.dm.unipi.it> 134*122966f8Smrg 135*122966f8Smrg * mini-gmp.c (mpz_get_si): fewer branches, safer forumla for negatives. 136*122966f8Smrg 137*122966f8Smrg * tests/t-signed.c: Removed a typo 138*122966f8Smrg 139*122966f8Smrg2016-11-24 Niels Möller <nisse@lysator.liu.se> 140*122966f8Smrg 141*122966f8Smrg * tests/hex-random.c (mkseed): Produce a 48-bit mpz_t value, 142*122966f8Smrg regardless of word size. 143*122966f8Smrg (hex_random_init): Use gmp_randseed instead of gmp_randseed_ui, 144*122966f8Smrg and support seeds exceeding an unsigned long. 145*122966f8Smrg 146*122966f8Smrg * tests/hex-random.c (mkseed): New function, using /dev/urandom 147*122966f8Smrg for random seed when available. 148*122966f8Smrg (hex_random_init): Use it. 149*122966f8Smrg 150*122966f8Smrg2016-11-23 Niels Möller <nisse@lysator.liu.se> 151*122966f8Smrg 152*122966f8Smrg * mini-gmp.c (GMP_CMP): New macro. 153*122966f8Smrg (mpz_sgn, mpz_cmp_si, mpz_cmp_ui, mpz_cmpabs_ui): Use it. 154*122966f8Smrg 155*122966f8Smrg2016-11-22 Niels Möller <nisse@lysator.liu.se> 156*122966f8Smrg 157*122966f8Smrg * tests/t-invert.c (test_3by2, test_2by1): New functions, 158*122966f8Smrg extracted from testmain. 159*122966f8Smrg (testmain): Add test with inputs which triggered the 160*122966f8Smrg mpn_invert_3by2 bug (see 2016-11-16 entry). 161*122966f8Smrg 162*122966f8Smrg2016-11-21 Marco Bodrato <bodrato@mail.dm.unipi.it> 163*122966f8Smrg 164*122966f8Smrg * tests/t-signed.c: compare different signs, and after overflow. 165*122966f8Smrg 166*122966f8Smrg2016-11-20 Niels Möller <nisse@lysator.liu.se> 167*122966f8Smrg 168*122966f8Smrg * tests/t-signed.c: Reorganize testcase, to avoid undefined 169*122966f8Smrg behaviour with signed overflow. 170*122966f8Smrg 171*122966f8Smrg2016-11-19 Niels Möller <nisse@lysator.liu.se> 172*122966f8Smrg 173*122966f8Smrg * tests/run-tests: Set up LD_LIBRARY_PATH and DYLD_LIBRARY_PATH 174*122966f8Smrg for tests only, based on TEST_LIBRARY_PATH. 175*122966f8Smrg 176*122966f8Smrg * tests/mini-random.h: Use name "../mini-gmp.h" for include, so we 177*122966f8Smrg don't need any -I options to the compiler. 178*122966f8Smrg 179*122966f8Smrg * tests/Makefile: Pass CFLAGS to the linker, as 180*122966f8Smrg recommended by the GNU coding standard. 181*122966f8Smrg (CPPFLAGS): New variable, with empty default value. 182*122966f8Smrg (CFLAGS): Remove the -I flag involving MINI_GMP_DIR, to leave free 183*122966f8Smrg for overriding on make command line. 184*122966f8Smrg (EXTRA_CFLAGS): Deleted variable, no longer needed. 185*122966f8Smrg 186*122966f8Smrg2016-11-18 Torbjörn Granlund <tg@gmplib.org> 187*122966f8Smrg 188*122966f8Smrg * tests/Makefile: Pass EXTRA_CFLAGS to linker as a intermediate fix. 189*122966f8Smrg 190*122966f8Smrg2016-11-17 Marco Bodrato <bodrato@mail.dm.unipi.it> 191*122966f8Smrg 192*122966f8Smrg * tests/t-str.c: free a pointer to avoid memory leaks. 193*122966f8Smrg 194*122966f8Smrg2016-11-16 Niels Möller <nisse@lysator.liu.se> 195*122966f8Smrg 196*122966f8Smrg * mini-gmp.c (mpn_invert_3by2): Fix arithmetic overflow 197*122966f8Smrg bug, and improve documentation of the algorithm. 198*122966f8Smrg 199*122966f8Smrg2016-11-15 Niels Möller <nisse@lysator.liu.se> 200*122966f8Smrg 201*122966f8Smrg * tests/t-limbs.c (testmain): Skip tests with zero product. 202*122966f8Smrg 203*122966f8Smrg * tests/hex-random.c (hex_random_init): Added fflush call. 204*122966f8Smrg 205*122966f8Smrg2016-11-15 Torbjörn Granlund <tg@gmplib.org> 206*122966f8Smrg 207*122966f8Smrg * tests/Makefile (TESTS): New variable, allowing separation of 208*122966f8Smrg compilation and running of tests. 209*122966f8Smrg * tests/run-tests: Allow empty tests list. 210*122966f8Smrg 211*122966f8Smrg2016-11-14 Marco Bodrato <bodrato@mail.dm.unipi.it> 212*122966f8Smrg 213*122966f8Smrg * tests/t-str.c: Some more test cases. 214*122966f8Smrg * tests/t-pprime_p.c: Use shorter operands, with different sizes. 215*122966f8Smrg 216*122966f8Smrg2016-11-01 Torbjörn Granlund <tg@gmplib.org> 217*122966f8Smrg 218*122966f8Smrg * tests/hex-random.c: Reinstate gmp.h inclusion. 219*122966f8Smrg 220*122966f8Smrg2016-08-22 Niels Möller <nisse@lysator.liu.se> 221*122966f8Smrg 222*122966f8Smrg * mini-gmp.c (mpn_set_str_other): Always return size >= 1, with 223*122966f8Smrg unnormalized result in the case the input digits are all zero. 224*122966f8Smrg Fixes crash on a large number of leading zeros, reported by Axel 225*122966f8Smrg Miller. 226*122966f8Smrg (mpz_set_str): Normalize as needed, after above change. Return 227*122966f8Smrg failure for inputs string with no digits, i.e., empty except for 228*122966f8Smrg optional sign, base prefix and white space. 229*122966f8Smrg 230*122966f8Smrg2016-01-01 Marco Bodrato <bodrato@mail.dm.unipi.it> 231*122966f8Smrg 232*122966f8Smrg * mini-gmp.c: Silence warnings due to (un)signed types. 233*122966f8Smrg * tests/testutils.c: Likewise. 234*122966f8Smrg * tests/t-logops.c: Likewise. 235*122966f8Smrg * tests/t-cmp_d.c: Likewise. 236*122966f8Smrg * tests/t-reuse.c: Likewise. 237*122966f8Smrg * tests/t-cong.c: Likewise. 238*122966f8Smrg 239*122966f8Smrg2015-11-13 Marco Bodrato <bodrato@mail.dm.unipi.it> 240*122966f8Smrg 241*122966f8Smrg * mini-gmp.c: Lazy allocation for mpz_t. 242*122966f8Smrg (mpz_rootrem): Exploit lazy allocation to avoid init2. 243*122966f8Smrg 244*122966f8Smrg2015-11-06 Marco Bodrato <bodrato@mail.dm.unipi.it> 245*122966f8Smrg 246*122966f8Smrg * mini-gmp.c (mpn_com, mpn_neg): New functions. 247*122966f8Smrg * mini-gmp.h: Declare them. 248*122966f8Smrg * mini-gmp.c (mpz_div_r_2exp): Use mpn_neg. 249*122966f8Smrg 250*122966f8Smrg2015-10-29 Marco Bodrato <bodrato@mail.dm.unipi.it> 251*122966f8Smrg 252*122966f8Smrg * mini-gmp.c: Removed a typo (spotted by Paul Zimmermann). 253*122966f8Smrg 254*122966f8Smrg2015-05-30 Marco Bodrato <bodrato@mail.dm.unipi.it> 255*122966f8Smrg 256*122966f8Smrg * mini-gmp.h: Declare mpn_zero_p. 257*122966f8Smrg * mini-gmp.c: Define mpn_zero_p as a function, not a macro. 258*122966f8Smrg 259*122966f8Smrg2014-08-27 Niels Möller <nisse@lysator.liu.se> 260*122966f8Smrg 261*122966f8Smrg * mini-gmp.c (mpz_abs_sub_bit): Do full normalization, 262*122966f8Smrg needed if mpz_clrbit clears the most significant one bit. 263*122966f8Smrg 264*122966f8Smrg2014-07-28 Marco Bodrato <bodrato@mail.dm.unipi.it> 265*122966f8Smrg 266*122966f8Smrg * mini-gmp.c: Remove some useless variables. 267*122966f8Smrg 268*122966f8Smrg2014-05-20 Marco Bodrato <bodrato@mail.dm.unipi.it> 269*122966f8Smrg 270*122966f8Smrg * mini-gmp.c: +1 in the init2 argument before setbit. 271*122966f8Smrg 272*122966f8Smrg2014-05-15 Marco Bodrato <bodrato@mail.dm.unipi.it> 273*122966f8Smrg 274*122966f8Smrg * mini-gmp.c: Micro-optimisations. 275*122966f8Smrg 276*122966f8Smrg2014-03-12 Marco Bodrato <bodrato@mail.dm.unipi.it> 277*122966f8Smrg 278*122966f8Smrg * mini-gmp.c (mpz_probab_prime_p): Micro-optimisation. 279*122966f8Smrg 280*122966f8Smrg2014-03-06 Niels Möller <nisse@lysator.liu.se> 281*122966f8Smrg 282*122966f8Smrg * mini-gmp.c (gmp_millerrabin): New internal function. 283*122966f8Smrg (mpz_probab_prime_p): New function. 284*122966f8Smrg * mini-gmp.h (mpz_probab_prime_p): Declare it. 285*122966f8Smrg * tests/t-pprime_p.c: New test program. 286*122966f8Smrg * tests/Makefile (CHECK_PROGRAMS): Added t-pprime_p. 287*122966f8Smrg 288*122966f8Smrg2014-03-03 Niels Möller <nisse@lysator.liu.se> 289*122966f8Smrg 290*122966f8Smrg * mini-gmp.c (mpz_congruent_p): New function. 291*122966f8Smrg * mini-gmp.h: Declare it. 292*122966f8Smrg * tests/t-cong.c: New file, based on tests/mpz/t-cong.c. 293*122966f8Smrg * tests/Makefile (CHECK_PROGRAMS): Added t-cong. 294*122966f8Smrg 295*122966f8Smrg * tests/testutils.c (dump): New function. Deleted static 296*122966f8Smrg functions in other files. 297*122966f8Smrg (mpz_set_str_or_abort): Moved function here, from... 298*122966f8Smrg * tests/t-cmp_d.c: ... old location. 299*122966f8Smrg 300*122966f8Smrg * tests/t-reuse.c (dump3): Renamed, from ... 301*122966f8Smrg (dump): ...old name. 302*122966f8Smrg 303*122966f8Smrg2014-02-21 Marco Bodrato <bodrato@mail.dm.unipi.it> 304*122966f8Smrg 305*122966f8Smrg * mini-gmp.c (mpn_sqrtrem): New function. 306*122966f8Smrg * mini-gmp.h: Declare it. 307*122966f8Smrg * tests/t-sqrt.c: Test it. 308*122966f8Smrg 309*122966f8Smrg2014-02-15 Marco Bodrato <bodrato@mail.dm.unipi.it> 310*122966f8Smrg 311*122966f8Smrg * mini-gmp.c (mpz_div_qr): init + set = init_set . 312*122966f8Smrg 313*122966f8Smrg2014-02-10 Marco Bodrato <bodrato@mail.dm.unipi.it> 314*122966f8Smrg 315*122966f8Smrg * tests/t-limbs.c: New test for mpz_limbs_*. 316*122966f8Smrg * tests/Makefile (CHECK_PROGRAMS): Add it. 317*122966f8Smrg 318*122966f8Smrg2014-02-08 Marco Bodrato <bodrato@mail.dm.unipi.it> 319*122966f8Smrg 320*122966f8Smrg * mini-gmp.c (mpz_realloc2, mpz_limbs_read, mpz_limbs_modify 321*122966f8Smrg mpz_limbs_write, mpz_limbs_finish, mpz_roinit_n): New functions. 322*122966f8Smrg (mpn_perfect_square_p): New function. 323*122966f8Smrg * mini-gmp.h: Declare them. 324*122966f8Smrg 325*122966f8Smrg * tests/t-mul.c: Use roinit and limbs_read to test mpn. 326*122966f8Smrg * tests/t-sqrt.c: Test also mpn_perfect_square_p. 327*122966f8Smrg 328*122966f8Smrg2014-02-03 Marco Bodrato <bodrato@mail.dm.unipi.it> 329*122966f8Smrg 330*122966f8Smrg * mini-gmp.c (mpn_rootrem): Allow NULL argument. 331*122966f8Smrg 332*122966f8Smrg * mini-gmp.c (mpn_zero): New function. 333*122966f8Smrg (mpz_perfect_square_p): New function. 334*122966f8Smrg * mini-gmp.h: Declare them. 335*122966f8Smrg 336*122966f8Smrg * tests/t-sqrt.c: Test mpz_perfect_square_p. 337*122966f8Smrg * tests/t-root.c: Test also 1-th root, allow perfect powers. 338*122966f8Smrg 339*122966f8Smrg2014-01-23 Marco Bodrato <bodrato@mail.dm.unipi.it> 340*122966f8Smrg 341*122966f8Smrg * tests/t-aorsmul.c: New file, test for mpz_{add,sub}mul{,_ui} 342*122966f8Smrg * tests/Makefile: Add t-aorsmul. 343*122966f8Smrg 344*122966f8Smrg2014-01-19 Marco Bodrato <bodrato@mail.dm.unipi.it> 345*122966f8Smrg 346*122966f8Smrg * mini-gmp.c (mpn_popcount): New function. 347*122966f8Smrg (mpz_popcount): Use it. 348*122966f8Smrg (mpz_addmul_ui, mpz_addmul, mpz_submul_ui, mpz_submul): Added. 349*122966f8Smrg * mini-gmp.h: Declare them. 350*122966f8Smrg 351*122966f8Smrg2014-01-16 Niels Möller <nisse@lysator.liu.se> 352*122966f8Smrg 353*122966f8Smrg * mini-gmp.c (mp_bits_per_limb): New const value. 354*122966f8Smrg * mini-gmp.h: Declare it. 355*122966f8Smrg 356*122966f8Smrg2013-03-13 Marco Bodrato <bodrato@mail.dm.unipi.it> 357*122966f8Smrg 358*122966f8Smrg * mini-gmp.c: Write loops in a cleaner way. 359*122966f8Smrg 360*122966f8Smrg2013-02-27 Marco Bodrato <bodrato@mail.dm.unipi.it> 361*122966f8Smrg 362*122966f8Smrg * mini-gmp.c (mpz_div_q_2exp): Adjust only if needed. 363*122966f8Smrg (mpn_common_scan): New service function to unify scan loops. 364*122966f8Smrg (mpz_scan0, mpz_scan1): Simplify by using mpn_common_scan. 365*122966f8Smrg (mpz_make_odd): Simplify, assume in-place operation on positive. 366*122966f8Smrg (mpn_scan0, mpn_scan1): New functions. 367*122966f8Smrg * mini-gmp.h (mpn_scan0, mpn_scan1): New declarations. 368*122966f8Smrg * tests/t-scan.c: Test also mpn_scan0 and mpn_scan1. 369*122966f8Smrg 370*122966f8Smrg2013-02-25 Niels Möller <nisse@lysator.liu.se> 371*122966f8Smrg 372*122966f8Smrg * tests/t-double.c (testmain): Declare double variables as 373*122966f8Smrg volatile, to drop extended precision. 374*122966f8Smrg 375*122966f8Smrg * tests/testutils.c (testfree): New function. Use it everywhere 376*122966f8Smrg where test programs deallocate storage allocated via the mini-gmp 377*122966f8Smrg allocation functions, including uses of mpz_get_str for various 378*122966f8Smrg test failure messages. 379*122966f8Smrg 380*122966f8Smrg2013-02-19 Marco Bodrato <bodrato@mail.dm.unipi.it> 381*122966f8Smrg 382*122966f8Smrg * mini-gmp.c: Move asserts to work-around a compiler bug. 383*122966f8Smrg (mpz_export): Reorder branches. 384*122966f8Smrg (mpz_mul_ui): Avoid temporary allocation (mpn_mul_1 can work in-place). 385*122966f8Smrg 386*122966f8Smrg * tests/t-reuse.c: Fix typo causing the same negation condition to 387*122966f8Smrg be applied to all operands. (See 2013-02-03, Torbjorn) 388*122966f8Smrg 389*122966f8Smrg2013-02-17 Marco Bodrato <bodrato@mail.dm.unipi.it> 390*122966f8Smrg 391*122966f8Smrg * mini-gmp.c (mpz_mul): Read sizes just once. 392*122966f8Smrg (mpn_set_str_other): Remove a redundant variable. 393*122966f8Smrg (mpz_abs_add): Use SWAP once, to order sizes. 394*122966f8Smrg (mpz_mul_ui): Micro-optimisation. 395*122966f8Smrg (mpz_rootrem): Use _init2 before _setbit. 396*122966f8Smrg (mpz_set_str): Optimise-out a variable. 397*122966f8Smrg (mpz_import): Normalise only if needed. 398*122966f8Smrg (mpn_div_qr_1): Speed-up the d=1 case, delaying a branch. 399*122966f8Smrg 400*122966f8Smrg2013-02-12 Marco Bodrato <bodrato@mail.dm.unipi.it> 401*122966f8Smrg 402*122966f8Smrg * mini-gmp.c (fac_ui, bin_uiui): Use shorter and faster code. 403*122966f8Smrg 404*122966f8Smrg * mini-gmp.c: Reduce branches. 405*122966f8Smrg 406*122966f8Smrg2013-01-23 Marco Bodrato <bodrato@mail.dm.unipi.it> 407*122966f8Smrg 408*122966f8Smrg * mini-gmp.c (mpz_cmpabs_d, mpz_cmp_d): Simplify. 409*122966f8Smrg (mpz_set_str): Behaviour more adherent to the real GMP. 410*122966f8Smrg 411*122966f8Smrg * tests/t-str.c: Cast size_t to unsigned long, for printf. 412*122966f8Smrg * tests/t-import.c: Likewise. 413*122966f8Smrg * tests/t-comb.c: Remove an unused var. 414*122966f8Smrg * tests/t-div.c: Remove unused args passed to fprintf. 415*122966f8Smrg * tests/t-double.c: Use float immediates with float vars. 416*122966f8Smrg 417*122966f8Smrg2013-01-22 Niels Möller <nisse@lysator.liu.se> 418*122966f8Smrg 419*122966f8Smrg * mini-gmp.c (mpz_cmp_d): Simplified, just sort out signs, then 420*122966f8Smrg call mpz_cmpabs_d. 421*122966f8Smrg 422*122966f8Smrg * tests/testutils.h: Include stdio.h and stdlib.h. 423*122966f8Smrg (numberof): New define. 424*122966f8Smrg 425*122966f8Smrg * tests/t-cmp_d.c: New file, copied from tests/mpz/t-cmp_d.c with 426*122966f8Smrg minor changes. 427*122966f8Smrg * tests/Makefile (CHECK_PROGRAMS): Added t-cmp_d, 428*122966f8Smrg 429*122966f8Smrg * mini-gmp.c (mpz_cmpabs_d): New function. 430*122966f8Smrg * mini-gmp.h: Declare it. 431*122966f8Smrg 432*122966f8Smrg2013-01-21 Niels Möller <nisse@lysator.liu.se> 433*122966f8Smrg 434*122966f8Smrg * tests/t-str.c (testmain): Test mpz_out_str, using 435*122966f8Smrg the tmpfile function for i/o. 436*122966f8Smrg 437*122966f8Smrg2013-01-20 Marco Bodrato <bodrato@mail.dm.unipi.it> 438*122966f8Smrg 439*122966f8Smrg * tests/testutils.c (testhalves): New function, test default 440*122966f8Smrg memory functions. 441*122966f8Smrg * tests/testutils.h (testhalves): Declare it 442*122966f8Smrg * tests/t-logops.c: Use testhalves. 443*122966f8Smrg 444*122966f8Smrg * mini-gmp.c (mpz_init_set_str): New function. 445*122966f8Smrg * mini-gmp.h (mpz_init_set_str): Declare it. 446*122966f8Smrg * tests/t-str.c: Test mpz_init_set_str. 447*122966f8Smrg 448*122966f8Smrg2013-01-19 Marco Bodrato <bodrato@mail.dm.unipi.it> 449*122966f8Smrg 450*122966f8Smrg * tests/t-double.c (testmain): Get the current free 451*122966f8Smrg function using mp_get_memory_functions. 452*122966f8Smrg * tests/t-str.c (testmain): Likewise. 453*122966f8Smrg 454*122966f8Smrg * tests/testutils.h (tu_free): Remove declaration. 455*122966f8Smrg 456*122966f8Smrg * tests/testutils.c (block_check, tu_free): Mark static. 457*122966f8Smrg 458*122966f8Smrg2013-01-18 Niels Möller <nisse@lysator.liu.se> 459*122966f8Smrg 460*122966f8Smrg * tests/t-str.c (test_small): New function, exercising 461*122966f8Smrg parsing of whitespace and base prefixes. 462*122966f8Smrg (testmain): Call it. 463*122966f8Smrg 464*122966f8Smrg * tests/t-gcd.c (gcdext_valid_p): Fixed memory leak. 465*122966f8Smrg 466*122966f8Smrg * tests/t-double.c (testmain): Call tu_free rather than 467*122966f8Smrg free, for storage allocated by mpz_get_str. 468*122966f8Smrg * tests/t-str.c (testmain): Likewise. 469*122966f8Smrg 470*122966f8Smrg * tests/testutils.c (block_init, block_check): New functions. 471*122966f8Smrg (tu_alloc, tu_realloc, tu_free): New functions. 472*122966f8Smrg (main): Use mp_set_memory_functions. 473*122966f8Smrg * tests/testutils.h (tu_free): Declare. 474*122966f8Smrg 475*122966f8Smrg * tests/testutils.h: New file, declarations for test programs. 476*122966f8Smrg 477*122966f8Smrg * tests/testutils.c (main): New file, with shared main 478*122966f8Smrg function for all the test programs. Also includes mini-gmp.c. 479*122966f8Smrg Calls testmain after initialization. All other test programs 480*122966f8Smrg updated to define testmain rather than main. 481*122966f8Smrg 482*122966f8Smrg2013-01-18 Marco Bodrato <bodrato@mail.dm.unipi.it> 483*122966f8Smrg 484*122966f8Smrg * tests/t-signed.c: Slightly larger coverage. 485*122966f8Smrg * tests/t-double.c: Test also mpz_init_set_d. 486*122966f8Smrg 487*122966f8Smrg2013-01-18 Torbjorn Granlund <tege@gmplib.org> 488*122966f8Smrg 489*122966f8Smrg * tests/t-div.c: Test mpz_divisible_p and mpz_divisible_ui_p. 490*122966f8Smrg 491*122966f8Smrg * tests/t-div.c: Test also mpz_mod, mpz_mod_ui. Compare 492*122966f8Smrg mpz_divisible_p just to ceil, to save time. 493*122966f8Smrg 494*122966f8Smrg * mini-gmp.c: Prefix some names with GMP_. 495*122966f8Smrg 496*122966f8Smrg2013-01-16 Marco Bodrato <bodrato@mail.dm.unipi.it> 497*122966f8Smrg 498*122966f8Smrg * tests/t-double.c: Test mpz_cmp_d. 499*122966f8Smrg * mini-gmp.c (mpz_cmp_d): Correct multiword comparison. 500*122966f8Smrg 501*122966f8Smrg * mini-gmp.c (mpz_set_str): Handle the empty string. 502*122966f8Smrg * tests/t-str.c: Test base <= 0. 503*122966f8Smrg 504*122966f8Smrg2013-01-15 Niels Möller <nisse@lysator.liu.se> 505*122966f8Smrg 506*122966f8Smrg * tests/t-str.c (main): Use x->_mp_d rather than x[0]._mp_d. 507*122966f8Smrg * tests/t-invert.c (main): Likewise. 508*122966f8Smrg 509*122966f8Smrg * tests/t-mul.c (main): Test mpn_mul_n and mpn_sqr. 510*122966f8Smrg 511*122966f8Smrg * tests/hex-random.h (enum hex_random_op): New value OP_SQR. 512*122966f8Smrg 513*122966f8Smrg * tests/mini-random.c (mini_random_op3): Renamed, from... 514*122966f8Smrg (mini_random_op): ... old name. Updated callers. 515*122966f8Smrg (mini_random_op2): New function. 516*122966f8Smrg 517*122966f8Smrg * tests/hex-random.c (hex_random_op3): Renamed, from... 518*122966f8Smrg (hex_random_op): ... old name. Updated callers. 519*122966f8Smrg (hex_random_op2): New function. 520*122966f8Smrg 521*122966f8Smrg2013-01-15 Marco Bodrato <bodrato@mail.dm.unipi.it> 522*122966f8Smrg 523*122966f8Smrg * tests/t-logops.c: Improve popcount/hamdist testing. 524*122966f8Smrg * tests/t-signed.c: Test more cases. 525*122966f8Smrg 526*122966f8Smrg2013-01-14 Niels Möller <nisse@lysator.liu.se> 527*122966f8Smrg 528*122966f8Smrg * tests/t-str.c (main): Added tests for mpn_get_str and 529*122966f8Smrg mpn_set_str. 530*122966f8Smrg 531*122966f8Smrg2013-01-11 Marco Bodrato <bodrato@mail.dm.unipi.it> 532*122966f8Smrg 533*122966f8Smrg * tests/t-comb.c: New test program, testing both 534*122966f8Smrg mpz_fac_ui and mpz_bin_uiui. 535*122966f8Smrg * tests/Makefile (CHECK_PROGRAMS): Added t-comb. 536*122966f8Smrg 537*122966f8Smrg * mini-gmp.c (mpz_mul_si): Simplify. 538*122966f8Smrg (mpz_mul_ui, mpz_mul, mpz_div_qr): Replace init+REALLOC with init2. 539*122966f8Smrg 540*122966f8Smrg * mini-gmp.c (NEG_CAST): New macro. 541*122966f8Smrg (mpz_mul_si, mpz_set_si, mpz_cmp_si): Use NEG_CAST. 542*122966f8Smrg 543*122966f8Smrg * mini-gmp.c (mpz_set_si, mpz_cmp_si): Simplify by using 544*122966f8Smrg the _ui variant. 545*122966f8Smrg 546*122966f8Smrg * tests/t-root.c: Use mpz_ui_pow_ui, when base fits an ui. 547*122966f8Smrg 548*122966f8Smrg * tests/t-mul.c: Test also mpz_mul_si. 549*122966f8Smrg * tests/t-sub.c: Test also mpz_ui_sub. 550*122966f8Smrg 551*122966f8Smrg * mini-gmp.c (mpz_fits_slong_p): Correct range. 552*122966f8Smrg * tests/t-signed.c: New test program, for get/set/cmp_si. 553*122966f8Smrg * tests/Makefile (CHECK_PROGRAMS): Added t-signed. 554*122966f8Smrg 555*122966f8Smrg * mini-gmp.c (mpz_hamdist): Handle different sizes. 556*122966f8Smrg * tests/t-logops.c: Test also popcount and hamdist. 557*122966f8Smrg 558*122966f8Smrg2013-01-10 Marco Bodrato <bodrato@mail.dm.unipi.it> 559*122966f8Smrg 560*122966f8Smrg * mini-gmp.c (mpz_export, mpz_import): Less restrictive ASSERTs. 561*122966f8Smrg * tests/t-import.c: Test also size=0 or count=0. 562*122966f8Smrg 563*122966f8Smrg2013-01-10 Torbjorn Granlund <tege@gmplib.org> 564*122966f8Smrg 565*122966f8Smrg * tests/t-import.c (main): Don't drop off function end. 566*122966f8Smrg 567*122966f8Smrg2013-01-09 Marco Bodrato <bodrato@mail.dm.unipi.it> 568*122966f8Smrg 569*122966f8Smrg * mini-gmp.c (mpz_export): Support op=0 countp=NULL. 570*122966f8Smrg 571*122966f8Smrg2013-01-08 Niels Möller <nisse@lysator.liu.se> 572*122966f8Smrg 573*122966f8Smrg * tests/t-import.c: New test program, testing both 574*122966f8Smrg mpz_import and mpz_export. 575*122966f8Smrg * tests/Makefile (CHECK_PROGRAMS): Added t-import. 576*122966f8Smrg 577*122966f8Smrg * tests/mini-random.c (mini_rrandomb_export): New function. 578*122966f8Smrg * tests/mini-random.h: Declare it. 579*122966f8Smrg * tests/hex-random.c (hex_rrandomb_export): New function. 580*122966f8Smrg * tests/hex-random.h: Declare it. 581*122966f8Smrg 582*122966f8Smrg * mini-gmp.c (mpz_export): Compute accurate word count up 583*122966f8Smrg front, to avoid generating any high zero words. 584*122966f8Smrg 585*122966f8Smrg2013-01-07 Marco Bodrato <bodrato@mail.dm.unipi.it> 586*122966f8Smrg 587*122966f8Smrg * README: Document base limitation for conversions. 588*122966f8Smrg * mini-gmp.c (mpz_set_str): Remove goto. 589*122966f8Smrg (mpz_import, mpz_export): Correctly use order/endianness. 590*122966f8Smrg 591*122966f8Smrg2013-01-04 Marco Bodrato <bodrato@mail.dm.unipi.it> 592*122966f8Smrg 593*122966f8Smrg From shuax: 594*122966f8Smrg * mini-gmp.c (mpz_import): Reset limb after storing it. 595*122966f8Smrg 596*122966f8Smrg2012-11-22 Niels Möller <nisse@lysator.liu.se> 597*122966f8Smrg 598*122966f8Smrg * tests/run-tests: Copied latest version from GNU Nettle. 599*122966f8Smrg Minor fix to the use of $EMULATOR, and proper copyright notice. 600*122966f8Smrg 601*122966f8Smrg2012-06-24 Marco Bodrato <bodrato@mail.dm.unipi.it> 602*122966f8Smrg 603*122966f8Smrg * mini-gmp.c (mpz_div_r_2exp, mpz_div_q_2exp): Improve 604*122966f8Smrg adjustment condition. 605*122966f8Smrg 606*122966f8Smrg2012-06-08 Marco Bodrato <bodrato@mail.dm.unipi.it> 607*122966f8Smrg 608*122966f8Smrg * mini-gmp.c (mpz_realloc): remove a branch. 609*122966f8Smrg 610*122966f8Smrg2012-05-25 Marco Bodrato <bodrato@mail.dm.unipi.it> 611*122966f8Smrg 612*122966f8Smrg * tests/t-div.c: Test all _qr, _q, _r variants. 613*122966f8Smrg * tests/t-lcm.c: Test the _ui variant. 614*122966f8Smrg 615*122966f8Smrg * mini-gmp.c (mpz_mod, mpz_mod_ui): New functions. 616*122966f8Smrg * mini-gmp.h (mpz_mod, mpz_mod_ui): Prototypes. 617*122966f8Smrg 618*122966f8Smrg2012-05-09 Marco Bodrato <bodrato@mail.dm.unipi.it> 619*122966f8Smrg 620*122966f8Smrg * mini-gmp.c: merge mpz_rootrem and mpz_sqrtrem. 621*122966f8Smrg 622*122966f8Smrg2012-04-13 Marco Bodrato <bodrato@mail.dm.unipi.it> 623*122966f8Smrg 624*122966f8Smrg * mini-gmp.h (mpz_fac_ui, mpz_bin_uiui): New definitions. 625*122966f8Smrg * mini-gmp.c (mpz_fac_ui, mpz_bin_uiui): Trivial implementation. 626*122966f8Smrg 627*122966f8Smrg2012-04-11 Marco Bodrato <bodrato@mail.dm.unipi.it> 628*122966f8Smrg 629*122966f8Smrg * mini-gmp.h (mpz_root, mpz_rootrem): define (correctly). 630*122966f8Smrg * mini-gmp.c (mpz_rootrem): Extended code from _root. 631*122966f8Smrg (mpz_root): Use mpz_rootrem. 632*122966f8Smrg (mpz_mul_ui): Correctly handle negative operands. 633*122966f8Smrg 634*122966f8Smrg * tests/Makefile (CHECK_PROGRAMS): add t-root. 635*122966f8Smrg * tests/t-root.c: New file. 636*122966f8Smrg * tests/t-reuse.c: Enable root{,rem} tests. 637*122966f8Smrg 638*122966f8Smrg2012-04-10 Marco Bodrato <bodrato@mail.dm.unipi.it> 639*122966f8Smrg 640*122966f8Smrg * mini-gmp.c (mpz_root): New, support negative operands. 641*122966f8Smrg * mini-gmp.h (mpz_root): define. 642*122966f8Smrg (mpz_out_str): Test also __STDIO_LOADED (for VMS). 643*122966f8Smrg * mpz/2fac_ui.c: Cosmetic change. 644*122966f8Smrg 645*122966f8Smrg * tests/t-reuse.c: New test case, based on tests/mpz/reuse.c. 646*122966f8Smrg 647*122966f8Smrg * mini-gmp.c (mpz_cdiv_r_ui): New function. 648*122966f8Smrg (mpz_fdiv_r_ui): New function. 649*122966f8Smrg (mpz_tdiv_r_ui): New function. 650*122966f8Smrg (mpz_powm_ui): New function. 651*122966f8Smrg (mpz_pow_ui): New function. 652*122966f8Smrg (mpz_ui_pow_ui): Use mpz_pow_ui. 653*122966f8Smrg (mpz_gcdext): Fixed input/output overlap, for the case of one 654*122966f8Smrg input being zero. 655*122966f8Smrg (mpz_sqrtrem): Fix for the case r NULL, U zero. 656*122966f8Smrg 657*122966f8Smrg2012-02-28 Niels Möller <nisse@lysator.liu.se> 658*122966f8Smrg 659*122966f8Smrg * tests/Makefile (srcdir, MINI_GMP_DIR): New make variables. These 660*122966f8Smrg can be overridden when using a separate build directory. 661*122966f8Smrg (EXTRA_CFLAGS): Renamed, was OPTFLAGS. 662*122966f8Smrg 663*122966f8Smrg * mini-gmp.c (mpz_abs_add): Don't cache limb pointers 664*122966f8Smrg over MPZ_REALLOC, since that breaks in-place operation. Bug 665*122966f8Smrg spotted by Torbjörn. 666*122966f8Smrg (mpz_and, mpz_ior, mpz_xor): Likewise. 667*122966f8Smrg (mpz_cmp): Fixed comparison of negative numbers. 668*122966f8Smrg 669*122966f8Smrg2012-02-26 Niels Möller <nisse@lysator.liu.se> 670*122966f8Smrg 671*122966f8Smrg * mini-gmp: New subdirectory. For use by GMP bootstrap, and as a 672*122966f8Smrg fallback for applications needing bignums but not high 673*122966f8Smrg performance. 674