Skip to content

Commit

Permalink
unsigned long -> mpir_ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
wbhart committed Feb 28, 2014
1 parent 77542fb commit ba01f26
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions gmp-h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions gmp-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1773,17 +1773,17 @@ 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;

#define gmp_init_primesieve __gmp_init_primesieve
__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);
Expand Down
2 changes: 1 addition & 1 deletion mpz/2fac_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion mpz/bin_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions mpz/bin_uiui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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]))
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion mpz/fac_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down
2 changes: 1 addition & 1 deletion mpz/gcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion mpz/lucnum2_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion mpz/lucnum_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion mpz/mfac_uiui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion mpz/primorial_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down
6 changes: 3 additions & 3 deletions nextprime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit ba01f26

Please sign in to comment.