[Gmp-commit] /var/hg/gmp-proj/mini-gmp: 3 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Tue Jan 10 09:26:44 CET 2012
details: /var/hg/gmp-proj/mini-gmp/rev/69a48c7448ed
changeset: 58:69a48c7448ed
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue Jan 10 09:15:15 2012 +0100
description:
Include <stddef.h>, for size_t. Improved file header.
details: /var/hg/gmp-proj/mini-gmp/rev/0eb5a0e48947
changeset: 59:0eb5a0e48947
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue Jan 10 09:15:40 2012 +0100
description:
Improved file header.
details: /var/hg/gmp-proj/mini-gmp/rev/44e854485004
changeset: 60:44e854485004
user: Niels M?ller <nisse at lysator.liu.se>
date: Tue Jan 10 09:26:11 2012 +0100
description:
>From Marco: popcount and comment improvements.
diffstat:
mini-gmp.c | 18 ++++++++++++------
mini-gmp.h | 11 +++++++----
2 files changed, 19 insertions(+), 10 deletions(-)
diffs (75 lines):
diff -r f39867e4af01 -r 44e854485004 mini-gmp.c
--- a/mini-gmp.c Sat Jan 07 23:30:10 2012 +0100
+++ b/mini-gmp.c Tue Jan 10 09:26:11 2012 +0100
@@ -1,5 +1,7 @@
-/* Implementation for GNU minimalistic multiple precision functions.
-
+/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
+
+ 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.
@@ -19,6 +21,10 @@
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
+/* NOTE: All functions in this file which are not declared in
+ mini-gmp.h are internal, and are not intended to be compatible
+ neither with GMP nor with future versions of mini-gmp. */
+
/* Much of the material copied from GMP files, including: gmp-impl.h,
longlong.h, mpn/generic/add_n.c, mpn/generic/addmul_1.c,
mpn/generic/lshift.c, mpn/generic/mul_1.c,
@@ -1714,7 +1720,7 @@
return an;
}
-/* Adds to the absolute value. Returns new size, (or -1 on underflow),
+/* Subtract from the absolute value. Returns new size, (or -1 on underflow),
but doesn't store it. */
static mp_size_t
mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
@@ -3214,9 +3220,9 @@
/* Do 16 bits at a time, to avoid limb-sized constants. */
for (c = 0; x > 0; x >>= 16)
{
- unsigned w = ((x & 0xaaaa) >> 1) + (x & 0x5555);
- w = ((w & 0xcccc) >> 2) + (w & 0x3333);
- w = ((w & 0xf0f0) >> 4) + (w & 0x0f0f);
+ unsigned w = ((x >> 1) & 0x5555) + (x & 0x5555);
+ w = ((w >> 2) & 0x3333) + (w & 0x3333);
+ w = ((w >> 4) & 0x0f0f) + (w & 0x0f0f);
w = (w >> 8) + (w & 0x00ff);
c += w;
}
diff -r f39867e4af01 -r 44e854485004 mini-gmp.h
--- a/mini-gmp.h Sat Jan 07 23:30:10 2012 +0100
+++ b/mini-gmp.h Tue Jan 10 09:26:11 2012 +0100
@@ -1,4 +1,4 @@
-/* Definitions for GNU minimalistic multiple precision functions.
+/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
Copyright 2011, 2012 Free Software Foundation, Inc.
@@ -20,13 +20,16 @@
/* About mini-gmp: This is a minimal implementation of a subset of the
GMP interface. It is intended for inclusion into applications which
have modest bignums needs, as a fallback when the real GMP library
- is not installed. */
-
-
+ is not installed.
+
+ This file defines the public interface. */
#ifndef __MINI_GMP_H__
#define __MINI_GMP_H__
+/* For size_t */
+#include <stddef.h>
+
#if defined (__cplusplus)
extern "C" {
#endif
More information about the gmp-commit
mailing list