"Marco Bodrato" <bodr...@mail.dm.unipi.it> writes: I looked into the code and realised that my proposal requires an MPZ_REALLOC or if(ALLOC(x)==0) branch in ANY place where we write into an mpz_t. E.g. mpz_combit starts with: if (limb_index + 1 < SIZ(x)) { PTR(x)[limb_index] ^= bit; return; } If we allow the ALLOC(x)==0 && SIZ(x) != 0 case, we need to insert a check also in the simpler cases... I assume this argues against being lazy with SIZE(x), not against being lazy with allocation?
Some weeks ago, I made a naive testsuite-driven attempt at implementing lazy allocation. I had 55 FAILures and 114 PASSes after having fixed these files: M mpz/clear.c M mpz/clears.c M mpz/init.c M mpz/mul.c M mpz/realloc.c M mpz/realloc2.c M mpz/set_si.c M mpz/set_ui.c M tests/mpz/t-limbs.c Curiously, there are some tests/mpn failures too. -- Torbjörn Please encrypt, key id 0xC8601622 _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel