[Gmp-commit] /var/hg/gmp: 8-bit popc_limb

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 12 12:09:43 CET 2012


details:   /var/hg/gmp/rev/6a17b1b9901a
changeset: 14566:6a17b1b9901a
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Jan 12 12:09:36 2012 +0100
description:
8-bit popc_limb

diffstat:

 ChangeLog  |  1 +
 gmp-impl.h |  7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r a46d83e9cfc7 -r 6a17b1b9901a ChangeLog
--- a/ChangeLog	Thu Jan 12 12:02:19 2012 +0100
+++ b/ChangeLog	Thu Jan 12 12:09:36 2012 +0100
@@ -2,6 +2,7 @@
 
 	* mpz/divexact.c: Tight realloc, delayed if variables are reused.
 	* mpz/lcm.c: Smaller temp space, avoid goto.
+	* gmp-impl.h (popc_limb): avoid double & (for 8-bits limb).
 
 2012-01-10 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
diff -r a46d83e9cfc7 -r 6a17b1b9901a gmp-impl.h
--- a/gmp-impl.h	Thu Jan 12 12:02:19 2012 +0100
+++ b/gmp-impl.h	Thu Jan 12 12:09:36 2012 +0100
@@ -4,7 +4,8 @@
    BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE GNU MP RELEASES.
 
 Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
-2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
+Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -3495,8 +3496,8 @@
     mp_limb_t  __x = (input);						\
     __x -= (__x >> 1) & MP_LIMB_T_MAX/3;				\
     __x = ((__x >> 2) & MP_LIMB_T_MAX/5) + (__x & MP_LIMB_T_MAX/5);	\
-    __x = ((__x >> 4) + __x) & MP_LIMB_T_MAX/17;			\
-    (result) = __x & 0xff;						\
+    __x = ((__x >> 4) + __x);						\
+    (result) = __x & 0x0f;						\
   } while (0)
 #endif
 


More information about the gmp-commit mailing list