[Gmp-commit] /home/hgfiles/gmp-5.0: mpz/mul: remove reduntant size computation.

mercurial at gmplib.org mercurial at gmplib.org
Tue Jan 25 18:58:58 CET 2011


details:   /home/hgfiles/gmp-5.0/rev/9578acabc06f
changeset: 13439:9578acabc06f
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Jan 25 18:58:53 2011 +0100
description:
mpz/mul: remove reduntant size computation.

diffstat:

 ChangeLog |   4 ++++
 mpz/mul.c |  12 ++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r 3a42b9599311 -r 9578acabc06f ChangeLog
--- a/ChangeLog	Tue Jan 25 18:07:23 2011 +0100
+++ b/ChangeLog	Tue Jan 25 18:58:53 2011 +0100
@@ -1,3 +1,7 @@
+2011-01-25 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpz/mul.c: Remove redundant size computation.
+
 2010-11-11  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/x86_64/atom/aors_n.asm: Don't rely on ZF after 'bt' insn.
diff -r 3a42b9599311 -r 9578acabc06f mpz/mul.c
--- a/mpz/mul.c	Tue Jan 25 18:07:23 2011 +0100
+++ b/mpz/mul.c	Tue Jan 25 18:58:53 2011 +0100
@@ -1,7 +1,7 @@
 /* mpz_mul -- Multiply two integers.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2009 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2009, 2011 Free
+Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -33,8 +33,8 @@
 mult (mpz_srcptr u, mpz_srcptr v, mpz_ptr w)
 #endif /* BERKELEY_MP */
 {
-  mp_size_t usize = SIZ(u);
-  mp_size_t vsize = SIZ(v);
+  mp_size_t usize;
+  mp_size_t vsize;
   mp_size_t wsize;
   mp_size_t sign_product;
   mp_ptr up, vp;
@@ -44,6 +44,8 @@
   mp_limb_t cy_limb;
   TMP_DECL;
 
+  usize = SIZ (u);
+  vsize = SIZ (v);
   sign_product = usize ^ vsize;
   usize = ABS (usize);
   vsize = ABS (vsize);
@@ -137,13 +139,11 @@
   if (up == vp)
     {
       mpn_sqr (wp, up, usize);
-      wsize = usize + vsize;
       cy_limb = wp[wsize - 1];
     }
   else
     {
       cy_limb = mpn_mul (wp, up, usize, vp, vsize);
-      wsize = usize + vsize;
     }
 
   wsize -= cy_limb == 0;


More information about the gmp-commit mailing list