[Gmp-commit] /var/hg/gmp: mpn_mod_1_1p_cps: Added comment on possible improve...

mercurial at gmplib.org mercurial at gmplib.org
Sat Feb 26 11:32:20 CET 2011


details:   /var/hg/gmp/rev/e36c4ca6ddb9
changeset: 13908:e36c4ca6ddb9
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Sat Feb 26 11:32:00 2011 +0100
description:
mpn_mod_1_1p_cps: Added comment on possible improvement in the normalized case.

diffstat:

 mpn/generic/mod_1_1.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 3ea54f250ae5 -r e36c4ca6ddb9 mpn/generic/mod_1_1.c
--- a/mpn/generic/mod_1_1.c	Fri Feb 25 21:42:43 2011 +0100
+++ b/mpn/generic/mod_1_1.c	Sat Feb 26 11:32:00 2011 +0100
@@ -50,6 +50,11 @@
   ASSERT (B1modb <= b);		/* NB: not fully reduced mod b */
   cps[2] = B1modb >> cnt;
 
+  /* In the normalized case, this can be simplified to
+   *
+   *   B2modb = - b * bi;
+   *   ASSERT (B2modb <= b);    // NB: equality iff b = B/2
+   */
   udiv_rnd_preinv (B2modb, B1modb, b, bi);
   cps[3] = B2modb >> cnt;
 }


More information about the gmp-commit mailing list