-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FLINT randstate #1964
Refactor FLINT randstate #1964
Conversation
There should be macros for |
Yes, agreed! |
I should also mention that I added clears of the random state in two |
This looks fine to me. The missing underscore in |
* Rename flint_rand_s to flint_rand_struct, * Replace fields `gmp_state` and `gmp_init` in `flint_rand_s` by `void * __gmp_state`, * Rename the following functions: flint_randinit -> flint_rand_init (different content) flint_randclear -> flint_rand_clear (different content) flint_randseed -> flint_rand_set_seed flint_get_randseed -> flint_rand_get_seed but keep the old names, marked as deprecated with the new keyword FLINT_DEPRECATED, to preserve backwards-compatibility. * Deprecate _flint_rand_init_gmp and replace with the two new functions _flint_rand_init_gmp_state and _flint_rand_clear_gmp_state. NOTE: The new init-function for the GMP-state assumes that __gmp_state *is not* initialized, and the new clear-function assumes that __gmp_state *is* initialized. To help with this, a new macro `FLINT_RAND_GMP_STATE_IS_INITIALISED(state)` can be utilized to check whether the GMP-state is initialized in `state`, assuming that `state` has been initialized via `flint_rand_init`. * Deprecate flint_rand_alloc and flint_rand_free. * Typedef `ulong` and `slong` to proper primitive C type instead of relying on GMP's `mp_limb_t` and `mp_limb_signed_t`.
Nemo still needs a fix, but I will push that soon. |
CI fails on Cygwin. |
Yes, I saw that. Will fix. |
Rename
flint_rand_s
toflint_rand_struct
,Replace fields
gmp_state
andgmp_init
inflint_rand_s
byvoid * __gmp_state
,Rename the following functions:
Remove
_flint_rand_init_gmp
and replace with the two new functions_flint_rand_init_gmp_state
and_flint_rand_clear_gmp_state
.NOTE: The new init-function for the GMP-state assumes that
__gmp_state
is not initialized, and the new clear-function assumes that__gmp_state
is initialized. To help with this, a new macroFLINT_RAND_GMP_STATE_IS_INITIALISED(state)
can be utilized to check whether the GMP-state is initialized instate
, assuming thatstate
has been initialized viaflint_rand_init
.Typedef
ulong
andslong
to proper primitive C type instead of relying on GMP'smp_limb_t
andmp_limb_signed_t
.