[Gmp-commit] /var/hg/gmp: mpn_sec_powm: Rename bit count argument.

mercurial at gmplib.org mercurial at gmplib.org
Tue Feb 11 21:27:03 UTC 2014


details:   /var/hg/gmp/rev/626160712a60
changeset: 16296:626160712a60
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Tue Feb 11 22:26:02 2014 +0100
description:
mpn_sec_powm: Rename bit count argument.

diffstat:

 doc/gmp.texi           |   8 ++++----
 mpn/generic/sec_powm.c |  40 ++++++++++++++++++++--------------------
 2 files changed, 24 insertions(+), 24 deletions(-)

diffs (134 lines):

diff -r 127b3f520a90 -r 626160712a60 doc/gmp.texi
--- a/doc/gmp.texi	Tue Feb 11 21:51:23 2014 +0100
+++ b/doc/gmp.texi	Tue Feb 11 22:26:02 2014 +0100
@@ -5743,18 +5743,18 @@
 @end deftypefun
 
 
- at deftypefun void mpn_sec_powm (mp_limb_t *@var{rp}, const mp_limb_t *@var{bp}, mp_size_t @var{bn}, const mp_limb_t *@var{ep}, mp_bitcnt_t @var{ebits},  const mp_limb_t *@var{mp}, mp_size_t @var{n}, mp_limb_t *@var{tp})
- at deftypefunx mp_size_t mpn_sec_powm_itch (mp_size_t @var{bn}, mp_bitcnt_t @var{ebits}, size_t @var{n})
+ at deftypefun void mpn_sec_powm (mp_limb_t *@var{rp}, const mp_limb_t *@var{bp}, mp_size_t @var{bn}, const mp_limb_t *@var{ep}, mp_bitcnt_t @var{enb},  const mp_limb_t *@var{mp}, mp_size_t @var{n}, mp_limb_t *@var{tp})
+ at deftypefunx mp_size_t mpn_sec_powm_itch (mp_size_t @var{bn}, mp_bitcnt_t @var{enb}, size_t @var{n})
 Set @var{R} to @m{B^E \bmod @var{M}, (@var{B} raised to @var{E}) modulo
 @var{M}}, where @var{R} = @{@var{rp}, at var{n}@}, @var{M} = @{@var{mp}, at var{n}@},
-and @var{E} consists of the least @var{ebits} in the area pointed to by @var{ep}.
+and @var{E} consists of the least @var{enb} in the area pointed to by @var{ep}.
 
 It is required that @math{@var{B} > 0}, and that @math{@var{M} > 0} is odd.
 
 No overlapping between @var{R} and the input operands is allowed.
 
 This function requires scratch space of @code{mpn_sec_powm_itch(@var{bn},
- at var{ebits}, @var{n})} limbs to be passed in the @var{tp} parameter.  The scratch
+ at var{enb}, @var{n})} limbs to be passed in the @var{tp} parameter.  The scratch
 space requirements are guaranteed to increase monotonously in the operand
 sizes.
 @end deftypefun
diff -r 127b3f520a90 -r 626160712a60 mpn/generic/sec_powm.c
--- a/mpn/generic/sec_powm.c	Tue Feb 11 21:51:23 2014 +0100
+++ b/mpn/generic/sec_powm.c	Tue Feb 11 22:26:02 2014 +0100
@@ -222,18 +222,18 @@
 extern int win_size (mp_bitcnt_t);
 #else
 static inline int
-win_size (mp_bitcnt_t eb)
+win_size (mp_bitcnt_t enb)
 {
   int k;
-  /* Find k, such that x[k-1] < eb <= x[k].
+  /* Find k, such that x[k-1] < enb <= x[k].
 
-     We require that x[k] >= k, then it follows that eb > x[k-1] >=
-     k-1, which implies k <= eb.
+     We require that x[k] >= k, then it follows that enb > x[k-1] >=
+     k-1, which implies k <= enb.
   */
   static const mp_bitcnt_t x[] = {0,POWM_SEC_TABLE,~(mp_bitcnt_t)0};
-  for (k = 1; eb > x[k]; k++)
+  for (k = 1; enb > x[k]; k++)
     ;
-  ASSERT (k <= eb);
+  ASSERT (k <= enb);
   return k;
 }
 #endif
@@ -256,7 +256,7 @@
    Uses scratch space at tp as defined by mpn_sec_powm_itch.  */
 void
 mpn_sec_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
-	      mp_srcptr ep, mp_bitcnt_t ebi,
+	      mp_srcptr ep, mp_bitcnt_t enb,
 	      mp_srcptr mp, mp_size_t n, mp_ptr tp)
 {
   mp_limb_t ip[2], *mip;
@@ -266,13 +266,13 @@
   long i;
   int cnd;
 
-  ASSERT (ebi > 0);
+  ASSERT (enb > 0);
   ASSERT (n >= 1 && ((mp[0] & 1) != 0));
   /* The code works for bn = 0, but the defined scratch space is 2 limbs
      greater than we supply, when converting 1 to redc form .  */
   ASSERT (bn >= 1);
 
-  windowsize = win_size (ebi);
+  windowsize = win_size (enb);
 
 #if WANT_REDC_2
   if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
@@ -328,9 +328,9 @@
 #endif
     }
 
-  expbits = getbits (ep, ebi, windowsize);
-  ASSERT_ALWAYS (ebi >= windowsize);
-  ebi -= windowsize;
+  expbits = getbits (ep, enb, windowsize);
+  ASSERT_ALWAYS (enb >= windowsize);
+  enb -= windowsize;
 
   mpn_sec_tabselect (rp, pp, n, 1 << windowsize, expbits);
 
@@ -339,17 +339,17 @@
   /*          | pp[0] | pp[1] | ...  | pp[2^windowsize-1] |  loop scratch |  */
 
 #define INNERLOOP							\
-  while (ebi != 0)							\
+  while (enb != 0)							\
     {									\
-      expbits = getbits (ep, ebi, windowsize);				\
+      expbits = getbits (ep, enb, windowsize);				\
       this_windowsize = windowsize;					\
-      if (ebi < windowsize)						\
+      if (enb < windowsize)						\
 	{								\
-	  this_windowsize -= windowsize - ebi;				\
-	  ebi = 0;							\
+	  this_windowsize -= windowsize - enb;				\
+	  enb = 0;							\
 	}								\
       else								\
-	ebi -= windowsize;						\
+	enb -= windowsize;						\
 									\
       do								\
 	{								\
@@ -412,7 +412,7 @@
 }
 
 mp_size_t
-mpn_sec_powm_itch (mp_size_t bn, mp_bitcnt_t eb, mp_size_t n)
+mpn_sec_powm_itch (mp_size_t bn, mp_bitcnt_t enb, mp_size_t n)
 {
   int windowsize;
   mp_size_t redcify_itch, itch;
@@ -422,7 +422,7 @@
      is 3n or 4n depending on if we use mpn_local_sqr or a native
      mpn_sqr_basecase.  We assume 4n always for now.) */
 
-  windowsize = win_size (eb);
+  windowsize = win_size (enb);
 
   /* The 2n term is due to pp[0] and pp[1] at the time of the 2nd redcify call,
      the (bn + n) term is due to redcify's own usage, and the rest is due to


More information about the gmp-commit mailing list