summaryrefslogtreecommitdiff
path: root/patches/gmp/4.3.1/100-multiplicity-that-does-not-fit-an-int.patch
blob: f60e88f304519799080a0a0fa1e8c2937faf1439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff --git a/mpz/remove.c b/mpz/remove.c
--- a/mpz/remove.c
+++ b/mpz/remove.c
@@ -23,7 +23,7 @@
 unsigned long int
 mpz_remove (mpz_ptr dest, mpz_srcptr src, mpz_srcptr f)
 {
-  mpz_t fpow[40];		/* inexhaustible...until year 2020 or so */
+  mpz_t fpow[GMP_LIMB_BITS];		/* Really MP_SIZE_T_BITS */
   mpz_t x, rem;
   unsigned long int pwr;
   int p;
@@ -69,7 +69,7 @@
       mpz_set (dest, x);
     }
 
-  pwr = (1 << p) - 1;
+  pwr = (1L << p) - 1;
 
   mpz_clear (fpow[p]);
 
diff --git a/mpz/remove.c b/mpz/remove.c
--- a/mpz/remove.c
+++ b/mpz/remove.c
@@ -80,7 +80,7 @@
       mpz_tdiv_qr (x, rem, dest, fpow[p]);
       if (SIZ (rem) == 0)
 	{
-	  pwr += 1 << p;
+	  pwr += 1L << p;
 	  mpz_set (dest, x);
 	}
       mpz_clear (fpow[p]);