[Gmp-commit] /var/hg/gmp: 2 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Mon Nov 16 20:25:02 UTC 2015


details:   /var/hg/gmp/rev/69fff61129a6
changeset: 16969:69fff61129a6
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Nov 16 18:03:08 2015 +0100
description:
Whitespace

details:   /var/hg/gmp/rev/9845905fe548
changeset: 16970:9845905fe548
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Nov 16 18:44:27 2015 +0100
description:
primesieve.c: Remove a couple of branches.

diffstat:

 mpz/bin_uiui.c     |   2 +-
 mpz/oddfac_1.c     |   2 +-
 mpz/primorial_ui.c |   2 +-
 primesieve.c       |  19 ++++++++++---------
 4 files changed, 13 insertions(+), 12 deletions(-)

diffs (89 lines):

diff -r 731d0cdf4bb7 -r 9845905fe548 mpz/bin_uiui.c
--- a/mpz/bin_uiui.c	Mon Nov 16 08:04:31 2015 +0100
+++ b/mpz/bin_uiui.c	Mon Nov 16 18:44:27 2015 +0100
@@ -502,7 +502,7 @@
 	}							\
       __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1);	\
       __index += __mask & 1;					\
-    }  while (__i <= __max_i)					\
+    }  while (__i <= __max_i)
 
 #define LOOP_ON_SIEVE_END					\
     LOOP_ON_SIEVE_STOP;						\
diff -r 731d0cdf4bb7 -r 9845905fe548 mpz/oddfac_1.c
--- a/mpz/oddfac_1.c	Mon Nov 16 08:04:31 2015 +0100
+++ b/mpz/oddfac_1.c	Mon Nov 16 18:44:27 2015 +0100
@@ -86,7 +86,7 @@
 	}							\
       __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1);	\
       __index += __mask & 1;					\
-    }  while (__i <= __max_i)					\
+    }  while (__i <= __max_i)
 
 #define LOOP_ON_SIEVE_END					\
     LOOP_ON_SIEVE_STOP;						\
diff -r 731d0cdf4bb7 -r 9845905fe548 mpz/primorial_ui.c
--- a/mpz/primorial_ui.c	Mon Nov 16 08:04:31 2015 +0100
+++ b/mpz/primorial_ui.c	Mon Nov 16 18:44:27 2015 +0100
@@ -73,7 +73,7 @@
 	}							\
       __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1);	\
       __index += __mask & 1;					\
-    }  while (__i <= __max_i)					\
+    }  while (__i <= __max_i)
 
 #define LOOP_ON_SIEVE_END					\
     LOOP_ON_SIEVE_STOP;						\
diff -r 731d0cdf4bb7 -r 9845905fe548 primesieve.c
--- a/primesieve.c	Mon Nov 16 08:04:31 2015 +0100
+++ b/primesieve.c	Mon Nov 16 18:44:27 2015 +0100
@@ -62,14 +62,14 @@
 								\
     LOOP_ON_SIEVE_CONTINUE(prime,end,sieve)
 
-#define LOOP_ON_SIEVE_STOP					\
+#define LOOP_ON_SIEVE_NOCOND					\
 	}							\
       __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1);	\
       __index += __mask & 1;					\
-    }  while (__i <= __max_i)					\
+    }  while (1)
 
-#define LOOP_ON_SIEVE_END					\
-    LOOP_ON_SIEVE_STOP;						\
+#define LOOP_ON_SIEVE_CLOSE					\
+    LOOP_ON_SIEVE_NOCOND;					\
   } while (0)
 
 /*********************************************************/
@@ -285,7 +285,7 @@
       lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
     };
   }
-  LOOP_ON_SIEVE_END;
+  LOOP_ON_SIEVE_CLOSE;
 }
 
 #define BLOCK_SIZE 2048
@@ -321,8 +321,9 @@
     mp_size_t off;
     off = BLOCK_SIZE + (size % BLOCK_SIZE);
     first_block_primesieve (bit_array, id_to_n (off * GMP_LIMB_BITS));
-    for ( ; off < size; off += BLOCK_SIZE)
-      block_resieve (bit_array + off, BLOCK_SIZE, off * GMP_LIMB_BITS, bit_array, off * GMP_LIMB_BITS - 1);
+    do {
+      block_resieve (bit_array + off, BLOCK_SIZE, off * GMP_LIMB_BITS, bit_array, off * GMP_LIMB_BITS);
+    } while ((off += BLOCK_SIZE) < size);
   } else {
     first_block_primesieve (bit_array, n);
   }
@@ -337,7 +338,7 @@
 #undef BLOCK_SIZE
 #undef SEED_LIMIT
 #undef SIEVE_SEED
-#undef LOOP_ON_SIEVE_END
-#undef LOOP_ON_SIEVE_STOP
+#undef LOOP_ON_SIEVE_CLOSE
+#undef LOOP_ON_SIEVE_NOCOND
 #undef LOOP_ON_SIEVE_BEGIN
 #undef LOOP_ON_SIEVE_CONTINUE


More information about the gmp-commit mailing list