[Gmp-commit] /var/hg/gmp: fac_ui: simplify.

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 26 22:57:03 CET 2012


details:   /var/hg/gmp/rev/00d74c41fcf0
changeset: 14586:00d74c41fcf0
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Jan 26 22:56:48 2012 +0100
description:
fac_ui: simplify.

diffstat:

 mpz/fac_ui.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (20 lines):

diff -r 3c33c8fe53c8 -r 00d74c41fcf0 mpz/fac_ui.c
--- a/mpz/fac_ui.c	Thu Jan 26 22:41:13 2012 +0100
+++ b/mpz/fac_ui.c	Thu Jan 26 22:56:48 2012 +0100
@@ -535,12 +535,13 @@
 
 	  TMP_MARK;
 
-	  ASSERT (primesieve_size (n - 1) <= (n / GMP_NUMB_BITS + 4) - (n / GMP_NUMB_BITS / 2 + 3));
+	  size = n / GMP_NUMB_BITS;
+	  ASSERT (primesieve_size (n - 1) <= (size + 4) - (size / 2 + 3));
 	  /* swing(n) < 2^(n-1)*sqrt(n/pi) < 2^(n+GMP_NUMB_BITS); one
 	     more can be overwritten by mul, another for the sieve */
-	  MPZ_TMP_INIT (swing, n / GMP_NUMB_BITS + 4);
+	  MPZ_TMP_INIT (swing, size + 4);
 	  /* Put the sieve on the second half, it will be overwritten by the last swing. */
-	  sieve = PTR(swing) + n / GMP_NUMB_BITS / 2 + 3;
+	  sieve = PTR(swing) + size / 2 + 3;
 
 	  size = (bitwise_primesieve (sieve, n - 1) + 1) / log_n_max (n) + 1;
 


More information about the gmp-commit mailing list