unsigned long -> mpir_ui.

This commit is contained in:
William Hart 2014-02-28 19:33:27 +00:00
parent 77542fb62b
commit ba01f2690d
12 changed files with 24 additions and 24 deletions

View File

@ -818,13 +818,13 @@ __GMP_DECLSPEC void *mpz_export __GMP_PROTO ((void *, size_t *, int, size_t, int
__GMP_DECLSPEC void mpz_fac_ui __GMP_PROTO ((mpz_ptr, mpir_ui));
#define mpz_2fac_ui __gmpz_2fac_ui
__GMP_DECLSPEC void mpz_2fac_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
__GMP_DECLSPEC void mpz_2fac_ui __GMP_PROTO ((mpz_ptr, mpir_ui));
#define mpz_mfac_uiui __gmpz_mfac_uiui
__GMP_DECLSPEC void mpz_mfac_uiui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int));
__GMP_DECLSPEC void mpz_mfac_uiui __GMP_PROTO ((mpz_ptr, mpir_ui, mpir_ui));
#define mpz_primorial_ui __gmpz_primorial_ui
__GMP_DECLSPEC void mpz_primorial_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
__GMP_DECLSPEC void mpz_primorial_ui __GMP_PROTO ((mpz_ptr, mpir_ui));
#define mpz_fdiv_q __gmpz_fdiv_q
__GMP_DECLSPEC void mpz_fdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));

View File

@ -1773,9 +1773,9 @@ log_n_max (mp_limb_t n)
#define SIEVESIZE 512 /* FIXME: Allow gmp_init_primesieve to choose */
typedef struct
{
unsigned long d; /* current index in s[] */
unsigned long s0; /* number corresponding to s[0] */
unsigned long sqrt_s0; /* misnomer for sqrt(s[SIEVESIZE-1]) */
mpir_ui d; /* current index in s[] */
mpir_ui s0; /* number corresponding to s[0] */
mpir_ui sqrt_s0; /* misnomer for sqrt(s[SIEVESIZE-1]) */
unsigned char s[SIEVESIZE + 1]; /* sieve table */
} gmp_primesieve_t;
@ -1783,7 +1783,7 @@ typedef struct
__GMP_DECLSPEC void gmp_init_primesieve (gmp_primesieve_t *);
#define gmp_nextprime __gmp_nextprime
__GMP_DECLSPEC unsigned long int gmp_nextprime (gmp_primesieve_t *);
__GMP_DECLSPEC mpir_ui gmp_nextprime (gmp_primesieve_t *);
#define gmp_primesieve __gmp_primesieve
__GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);

View File

@ -54,7 +54,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
WARNING: it assumes that n fits in a limb!
*/
void
mpz_2fac_ui (mpz_ptr x, unsigned long n)
mpz_2fac_ui (mpz_ptr x, mpir_ui n)
{
ASSERT (n <= GMP_NUMB_MAX);

View File

@ -38,7 +38,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
} while (0)
void
mpz_bin_ui (mpz_ptr r, mpz_srcptr n, unsigned long int k)
mpz_bin_ui (mpz_ptr r, mpz_srcptr n, mpir_ui k)
{
mpz_t ni;
mp_limb_t i;

View File

@ -240,7 +240,7 @@ static const unsigned long ftab[] =
static const mp_limb_t facinv[] = { ONE_LIMB_ODD_FACTORIAL_INVERSES_TABLE };
static void
mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
mpz_bdiv_bin_uiui (mpz_ptr r, mpir_ui n, mpir_ui k)
{
int nmax, kmax, nmaxnow, numfac;
mp_ptr np, kp;
@ -358,7 +358,7 @@ mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
}
static void
mpz_smallk_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
mpz_smallk_bin_uiui (mpz_ptr r, mpir_ui n, mpir_ui k)
{
int nmax, numfac;
mp_ptr rp;
@ -416,7 +416,7 @@ mpz_smallk_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
*/
static mp_limb_t
bc_bin_uiui (unsigned int n, unsigned int k)
bc_bin_uiui (mpir_ui n, mpir_ui k)
{
return ((__gmp_oddfac_table[n] * facinv[k - 2] * facinv[n - k - 2])
<< (__gmp_fac2cnt_table[n / 2 - 1] - __gmp_fac2cnt_table[k / 2 - 1] - __gmp_fac2cnt_table[(n-k) / 2 - 1]))
@ -443,11 +443,11 @@ static const mp_limb_t bin2kkinv[] = { ONE_LIMB_ODD_CENTRAL_BINOMIAL_INVERSE_TAB
static const unsigned char fac2bin[] = { CENTRAL_BINOMIAL_2FAC_TABLE };
static void
mpz_smallkdc_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
mpz_smallkdc_bin_uiui (mpz_ptr r, mpir_ui n, mpir_ui k)
{
mp_ptr rp;
mp_size_t rn;
unsigned long int hk;
mpir_ui hk;
hk = k >> 1;
@ -706,7 +706,7 @@ mpz_goetgheluck_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
/*********************************************************/
void
mpz_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
mpz_bin_uiui (mpz_ptr r, mpir_ui n, mpir_ui k)
{
if (UNLIKELY (n < k)) {
SIZ (r) = 0;

View File

@ -58,7 +58,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
WARNING: it assumes that n fits in a limb!
*/
void
mpz_fac_ui (mpz_ptr x, unsigned long n)
mpz_fac_ui (mpz_ptr x, mpir_ui n)
{
static const mp_limb_t table[] = { ONE_LIMB_FACTORIAL_TABLE };

View File

@ -26,7 +26,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
void
mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
{
unsigned long int g_zero_bits, u_zero_bits, v_zero_bits;
mpir_ui g_zero_bits, u_zero_bits, v_zero_bits;
mp_size_t g_zero_limbs, u_zero_limbs, v_zero_limbs;
mp_ptr tp;
mp_ptr up;

View File

@ -23,7 +23,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
void
mpz_lucnum2_ui (mpz_ptr ln, mpz_ptr lnsub1, unsigned long n)
mpz_lucnum2_ui (mpz_ptr ln, mpz_ptr lnsub1, mpir_ui n)
{
mp_ptr lp, l1p, f1p;
mp_size_t size;

View File

@ -44,7 +44,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
obviously huge, but probably should be made to work. */
void
mpz_lucnum_ui (mpz_ptr ln, unsigned long n)
mpz_lucnum_ui (mpz_ptr ln, mpir_ui n)
{
mp_size_t lalloc, xalloc, lsize, xsize;
mp_ptr lp, xp;

View File

@ -42,7 +42,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* mpz_mfac_uiui (x, n, m) computes x = n!^(m) = n*(n-m)*(n-2m)*... */
void
mpz_mfac_uiui (mpz_ptr x, unsigned long n, unsigned long m)
mpz_mfac_uiui (mpz_ptr x, mpir_ui n, mpir_ui m)
{
ASSERT (n <= GMP_NUMB_MAX);
ASSERT (m != 0);

View File

@ -95,7 +95,7 @@ primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
/*********************************************************/
void
mpz_primorial_ui (mpz_ptr x, unsigned long n)
mpz_primorial_ui (mpz_ptr x, mpir_ui n)
{
static const mp_limb_t table[] = { 1, 1, 2, 6, 6 };

View File

@ -46,16 +46,16 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include <string.h> /* for memset */
unsigned long int
mpir_ui
gmp_nextprime (gmp_primesieve_t *ps)
{
unsigned long p, d, pi;
mpir_ui p, d, pi;
unsigned char *sp;
static unsigned char addtab[] =
{ 2,4,2,4,6,2,6,4,2,4,6,6,2,6,4,2,6,4,6,8,4,2,4,2,4,8,6,4,6,2,4,6,2,6,6,4,
2,4,6,2,6,4,2,4,2,10,2,10 };
unsigned char *addp = addtab;
unsigned long ai;
mpir_ui ai;
/* Look for already sieved primes. A sentinel at the end of the sieving
area allows us to use a very simple loop here. */