Skip to content

Commit

Permalink
Merge pull request #2057 from vneiger/fix_flint_test_clear
Browse files Browse the repository at this point in the history
flint_test_clear
  • Loading branch information
vneiger committed Aug 27, 2024
2 parents 338df24 + cdc62e1 commit 042e378
Show file tree
Hide file tree
Showing 111 changed files with 140 additions and 134 deletions.
2 changes: 1 addition & 1 deletion examples/fq_poly.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int main(void)
fmpz_clear(p);
}

FLINT_TEST_CLEANUP(state);
FLINT_TEST_CLEAR(state);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/radix.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int main(void)
flint_free(b);
fmpz_mod_ctx_clear(ctx);

FLINT_TEST_CLEANUP(state);
FLINT_TEST_CLEAR(state);

return 0;
}
2 changes: 2 additions & 0 deletions src/aprcl/profile/p-is_prime_aprcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,5 +760,7 @@ int main(void)
flint_free(ns);
}

FLINT_TEST_CLEAR(state)

return 0;
}
3 changes: 3 additions & 0 deletions src/aprcl/profile/p-is_prime_aprcl_big.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "flint.h"
#include "profiler.h"
#include "fmpz.h"
#include "aprcl.h"
Expand Down Expand Up @@ -419,5 +420,7 @@ int main(void)
fmpz_clear(n);
}

FLINT_TEST_CLEAR(state)

return 0;
}
2 changes: 1 addition & 1 deletion src/fft/profile/p-mul_mfa_truncate_sqrt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ main(void)
flint_free(i1);
}

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);

flint_printf("done\n");
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/fft/profile/p-mul_truncate_sqrt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ main(void)
flint_free(i1);
}

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);

flint_printf("done\n");
return 0;
Expand Down
5 changes: 3 additions & 2 deletions src/fft/tune/tune-fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ main(void)

flint_printf("#define FFT_MULMOD_2EXPP1_CUTOFF %wd\n\n", ((mp_limb_t) 1 << best_d)*best_w/(2*FLINT_BITS));

flint_rand_clear(state);

flint_printf("#endif\n");

FLINT_TEST_CLEAR(state);

return 0;
}
2 changes: 1 addition & 1 deletion src/flint.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ FLINT_INLINE ulong n_randint(flint_rand_t state, ulong limit)
FLINT_GC_INIT(); \
flint_rand_init(xxx)

#define FLINT_TEST_CLEANUP(xxx) \
#define FLINT_TEST_CLEAR(xxx) \
flint_rand_clear(xxx); \
flint_cleanup_master();

Expand Down
4 changes: 2 additions & 2 deletions src/fmpz/profile/p-addmul.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ sample_new(void * arg, ulong count)
_fmpz_vec_clear(res, ntests);
_fmpz_vec_clear(a, ntests);
_fmpz_vec_clear(b, ntests);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void
Expand Down Expand Up @@ -111,7 +111,7 @@ sample_old(void * arg, ulong count)
_fmpz_vec_clear(res, ntests);
_fmpz_vec_clear(a, ntests);
_fmpz_vec_clear(b, ntests);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

slong sizes[] = { 10, 30, 60, 62, 64, 66, 80, 128, 160, 256, 512, 1024, 4096, 0 };
Expand Down
8 changes: 4 additions & 4 deletions src/fmpz/profile/p-aors_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ sample_add_new(void * arg, ulong count)
_fmpz_vec_clear(res, ntests);
_fmpz_vec_clear(a, ntests);
flint_free(b);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void
Expand Down Expand Up @@ -474,7 +474,7 @@ sample_add_old(void * arg, ulong count)
_fmpz_vec_clear(res, ntests);
_fmpz_vec_clear(a, ntests);
flint_free(b);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void
Expand Down Expand Up @@ -509,7 +509,7 @@ sample_sub_new(void * arg, ulong count)
_fmpz_vec_clear(res, ntests);
_fmpz_vec_clear(a, ntests);
flint_free(b);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void
Expand Down Expand Up @@ -544,7 +544,7 @@ sample_sub_old(void * arg, ulong count)
_fmpz_vec_clear(res, ntests);
_fmpz_vec_clear(a, ntests);
flint_free(b);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}


Expand Down
8 changes: 4 additions & 4 deletions src/fmpz/profile/p-div_qr.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void sample_ndiv_qr(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_fdiv_qr(void * arg, ulong count)
Expand Down Expand Up @@ -90,7 +90,7 @@ void sample_fdiv_qr(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_cdiv_qr(void * arg, ulong count)
Expand Down Expand Up @@ -130,7 +130,7 @@ void sample_cdiv_qr(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_tdiv_qr(void * arg, ulong count)
Expand Down Expand Up @@ -170,7 +170,7 @@ void sample_tdiv_qr(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

int main(void)
Expand Down
2 changes: 1 addition & 1 deletion src/fmpz/profile/p-fdiv_qr_preinvn.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void sample(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(c);
fmpz_clear(r);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

int main(void)
Expand Down
12 changes: 6 additions & 6 deletions src/fmpz/profile/p-fmma.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void sample_small(void * arg, ulong count)
fmpz_clear(c);
fmpz_clear(d);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_small_old(void * arg, ulong count)
Expand Down Expand Up @@ -136,7 +136,7 @@ void sample_small_old(void * arg, ulong count)
fmpz_clear(c);
fmpz_clear(d);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_small_zeros(void * arg, ulong count)
Expand Down Expand Up @@ -170,7 +170,7 @@ void sample_small_zeros(void * arg, ulong count)
fmpz_clear(c);
fmpz_clear(d);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_small_zeros_old(void * arg, ulong count)
Expand Down Expand Up @@ -204,7 +204,7 @@ void sample_small_zeros_old(void * arg, ulong count)
fmpz_clear(c);
fmpz_clear(d);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_big_zeros(void * arg, ulong count)
Expand Down Expand Up @@ -238,7 +238,7 @@ void sample_big_zeros(void * arg, ulong count)
fmpz_clear(c);
fmpz_clear(d);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_big_zeros_old(void * arg, ulong count)
Expand Down Expand Up @@ -272,7 +272,7 @@ void sample_big_zeros_old(void * arg, ulong count)
fmpz_clear(c);
fmpz_clear(d);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

int main(void)
Expand Down
4 changes: 2 additions & 2 deletions src/fmpz/profile/p-gcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ sample_new(void * arg, ulong count)
fmpz_clear(a);
fmpz_clear(b);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void
Expand Down Expand Up @@ -135,7 +135,7 @@ sample_old(void * arg, ulong count)
fmpz_clear(a);
fmpz_clear(b);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

int
Expand Down
4 changes: 2 additions & 2 deletions src/fmpz/profile/p-gcd3.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ sample_new(void * arg, ulong count)
fmpz_clear(a);
fmpz_clear(b);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void
Expand Down Expand Up @@ -210,7 +210,7 @@ sample_old(void * arg, ulong count)
fmpz_clear(a);
fmpz_clear(b);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

int
Expand Down
4 changes: 2 additions & 2 deletions src/fmpz/profile/p-mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ sample_new(void * arg, ulong count)
_fmpz_vec_clear(res, ntests);
_fmpz_vec_clear(a, ntests);
_fmpz_vec_clear(b, ntests);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void
Expand Down Expand Up @@ -111,7 +111,7 @@ sample_old(void * arg, ulong count)
_fmpz_vec_clear(res, ntests);
_fmpz_vec_clear(a, ntests);
_fmpz_vec_clear(b, ntests);
flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

slong sizes[] = { 10, 30, 60, 62, 64, 66, 80, 128, 160, 256, 512, 1024, 4096, 0 };
Expand Down
4 changes: 2 additions & 2 deletions src/fmpz/profile/p-mul_2exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ sample_new(void * arg, ulong count)
prof_stop();
}

flint_rand_clear(state);
fmpz_clear(res);
fmpz_clear(a);
FLINT_TEST_CLEAR(state);
}

void
Expand All @@ -97,9 +97,9 @@ sample_old(void * arg, ulong count)
prof_stop();
}

flint_rand_clear(state);
fmpz_clear(res);
fmpz_clear(a);
FLINT_TEST_CLEAR(state);
}

int
Expand Down
4 changes: 2 additions & 2 deletions src/fmpz/profile/p-mul_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ sample_new(void * arg, ulong count)
prof_stop();
}

flint_rand_clear(state);
fmpz_clear(res);
fmpz_clear(a);
FLINT_TEST_CLEAR(state);
}

void
Expand All @@ -99,9 +99,9 @@ sample_old(void * arg, ulong count)
prof_stop();
}

flint_rand_clear(state);
fmpz_clear(res);
fmpz_clear(a);
FLINT_TEST_CLEAR(state);
}

int
Expand Down
12 changes: 6 additions & 6 deletions src/fmpz/profile/p-xgcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void sample_xgcd_small(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_xgcd_mixed(void * arg, ulong count)
Expand Down Expand Up @@ -79,7 +79,7 @@ void sample_xgcd_mixed(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_xgcd_big(void * arg, ulong count)
Expand Down Expand Up @@ -114,7 +114,7 @@ void sample_xgcd_big(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_xgcd_canonical_bezout_small(void * arg, ulong count)
Expand Down Expand Up @@ -149,7 +149,7 @@ void sample_xgcd_canonical_bezout_small(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_xgcd_canonical_bezout_mixed(void * arg, ulong count)
Expand Down Expand Up @@ -184,7 +184,7 @@ void sample_xgcd_canonical_bezout_mixed(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

void sample_xgcd_canonical_bezout_big(void * arg, ulong count)
Expand Down Expand Up @@ -219,7 +219,7 @@ void sample_xgcd_canonical_bezout_big(void * arg, ulong count)
fmpz_clear(b);
fmpz_clear(nmax);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);
}

int main(void)
Expand Down
2 changes: 1 addition & 1 deletion src/fmpz_factor/profile/p-factor_pp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main(void)
flint_printf("Factor not found!\n");
} while(1);

flint_rand_clear(state);
FLINT_TEST_CLEAR(state);

fmpz_clear(n);
fmpz_clear(p);
Expand Down
Loading

0 comments on commit 042e378

Please sign in to comment.