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