[Gmp-commit] /var/hg/gmp: mini-gmp/mini-gmp.c (mpz_import): Reset limb after ...

mercurial at gmplib.org mercurial at gmplib.org
Fri Jan 4 16:32:06 CET 2013


details:   /var/hg/gmp/rev/87a24013e9ee
changeset: 15234:87a24013e9ee
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Jan 04 16:32:01 2013 +0100
description:
mini-gmp/mini-gmp.c (mpz_import): Reset limb after storing it.

diffstat:

 ChangeLog           |  5 +++++
 mini-gmp/mini-gmp.c |  7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 1ba013aa3156 -r 87a24013e9ee ChangeLog
--- a/ChangeLog	Fri Jan 04 15:44:43 2013 +0100
+++ b/ChangeLog	Fri Jan 04 16:32:01 2013 +0100
@@ -1,3 +1,8 @@
+2013-01-04 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	From shuax:
+	* mini-gmp/mini-gmp.c (mpz_import): Reset limb after storing it.
+
 2013-01-04  Torbjorn Granlund  <tege at gmplib.org>
 
 	From Marko Lindqvist:
diff -r 1ba013aa3156 -r 87a24013e9ee mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Fri Jan 04 15:44:43 2013 +0100
+++ b/mini-gmp/mini-gmp.c	Fri Jan 04 16:32:01 2013 +0100
@@ -3,8 +3,8 @@
    Contributed to the GNU project by Niels Möller
 
 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free
-Software Foundation, Inc.
+2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
+Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -4061,11 +4061,12 @@
       size_t j;
       for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
 	{
-	  limb |= *p << (bytes++ * CHAR_BIT);
+	  limb |= (mp_limb_t) *p << (bytes++ * CHAR_BIT);
 	  if (bytes == sizeof(mp_limb_t))
 	    {
 	      rp[i++] = limb;
 	      bytes = 0;
+	      limb = 0;
 	    }
 	}
     }


More information about the gmp-commit mailing list