Index: coeffs/rmodulo2m.cc
===================================================================
--- coeffs/rmodulo2m.cc	(revision 5d594a96114bdb26100c2b8e2ae329a7529f0e45)
+++ coeffs/rmodulo2m.cc	(revision e90dfd63ba042c3039aaf9befd499429b808a368)
@@ -24,6 +24,4 @@
 #include <string.h>
 
-int nr2mExp;
-
 extern omBin gmp_nrz_bin; /* init in rintegers*/
 
@@ -34,7 +32,7 @@
   nr2mInitExp((int)(long)(p), r);
 
-  r->cfInit       = nr2mInit;
-  r->cfCopy       = ndCopy;
-  r->cfInt        = nr2mInt;
+  r->cfInit        = nr2mInit;
+  r->cfCopy        = ndCopy;
+  r->cfInt         = nr2mInt;
   r->cfAdd         = nr2mAdd;
   r->cfSub         = nr2mSub;
@@ -54,8 +52,8 @@
   r->cfIsMOne      = nr2mIsMOne;
   r->cfGreaterZero = nr2mGreaterZero;
-  r->cfWrite      = nr2mWrite;
+  r->cfWrite       = nr2mWrite;
   r->cfRead        = nr2mRead;
   r->cfPower       = nr2mPower;
-  r->cfSetMap     = nr2mSetMap;
+  r->cfSetMap      = nr2mSetMap;
   r->cfNormalize   = ndNormalize;
   r->cfLcm         = nr2mLcm;
@@ -75,77 +73,77 @@
  * Multiply two numbers
  */
-number nr2mMult (number a, number b, const coeffs r)
+number nr2mMult(number a, number b, const coeffs r)
 {
   if (((NATNUMBER)a == 0) || ((NATNUMBER)b == 0))
     return (number)0;
   else
-    return nr2mMultM(a,b,r);
-}
-
-/*
- * Give the smallest non unit k, such that a * x = k = b * y has a solution
+    return nr2mMultM(a, b, r);
+}
+
+/*
+ * Give the smallest k, such that a * x = k = b * y has a solution
  */
-number nr2mLcm (number a, number b, const coeffs r)
+number nr2mLcm(number a, number b, const coeffs r)
 {
   NATNUMBER res = 0;
-  if ((NATNUMBER) a == 0) a = (number) 1;
-  if ((NATNUMBER) b == 0) b = (number) 1;
-  while ((NATNUMBER) a % 2 == 0)
-  {
-    a = (number) ((NATNUMBER) a / 2);
-    if ((NATNUMBER) b % 2 == 0) b = (number) ((NATNUMBER) b / 2);
+  if ((NATNUMBER)a == 0) a = (number) 1;
+  if ((NATNUMBER)b == 0) b = (number) 1;
+  while ((NATNUMBER)a % 2 == 0)
+  {
+    a = (number)((NATNUMBER)a / 2);
+    if ((NATNUMBER)b % 2 == 0) b = (number)((NATNUMBER)b / 2);
     res++;
   }
-  while ((NATNUMBER) b % 2 == 0)
-  {
-    b = (number) ((NATNUMBER) b / 2);
+  while ((NATNUMBER)b % 2 == 0)
+  {
+    b = (number)((NATNUMBER)b / 2);
     res++;
   }
-  return (number) (1L << res);  // (2**res)
-}
-
-/*
- * Give the largest non unit k, such that a = x * k, b = y * k has
+  return (number)(1L << res);  // (2**res)
+}
+
+/*
+ * Give the largest k, such that a = x * k, b = y * k has
  * a solution.
  */
-number nr2mGcd (number a, number b, const coeffs r)
+number nr2mGcd(number a, number b, const coeffs r)
 {
   NATNUMBER res = 0;
-  if ((NATNUMBER) a == 0 && (NATNUMBER) b == 0) return (number) 1;
-  while ((NATNUMBER) a % 2 == 0 && (NATNUMBER) b % 2 == 0)
-  {
-    a = (number) ((NATNUMBER) a / 2);
-    b = (number) ((NATNUMBER) b / 2);
+  if ((NATNUMBER)a == 0 && (NATNUMBER)b == 0) return (number)1;
+  while ((NATNUMBER)a % 2 == 0 && (NATNUMBER)b % 2 == 0)
+  {
+    a = (number)((NATNUMBER)a / 2);
+    b = (number)((NATNUMBER)b / 2);
     res++;
   }
-//  if ((NATNUMBER) b % 2 == 0)
+//  if ((NATNUMBER)b % 2 == 0)
 //  {
-//    return (number) ((1L << res));// * (NATNUMBER) a);  // (2**res)*a    a ist Einheit
+//    return (number)((1L << res)); // * (NATNUMBER) a);  // (2**res)*a    a is a unit
 //  }
 //  else
 //  {
-    return (number) ((1L << res));// * (NATNUMBER) b);  // (2**res)*b    b ist Einheit
+    return (number)((1L << res)); // * (NATNUMBER) b);  // (2**res)*b    b is a unit
 //  }
 }
 
 /*
- * Give the largest non unit k, such that a = x * k, b = y * k has
+ * Give the largest k, such that a = x * k, b = y * k has
  * a solution.
  */
-number nr2mExtGcd (number a, number b, number *s, number *t, const coeffs r)
+number nr2mExtGcd(number a, number b, number *s, number *t, const coeffs r)
 {
   NATNUMBER res = 0;
-  if ((NATNUMBER) a == 0 && (NATNUMBER) b == 0) return (number) 1;
-  while ((NATNUMBER) a % 2 == 0 && (NATNUMBER) b % 2 == 0)
-  {
-    a = (number) ((NATNUMBER) a / 2);
-    b = (number) ((NATNUMBER) b / 2);
+  if ((NATNUMBER)a == 0 && (NATNUMBER)b == 0) return (number)1;
+  while ((NATNUMBER)a % 2 == 0 && (NATNUMBER)b % 2 == 0)
+  {
+    a = (number)((NATNUMBER)a / 2);
+    b = (number)((NATNUMBER)b / 2);
     res++;
   }
-  if ((NATNUMBER) b % 2 == 0)
+  if ((NATNUMBER)b % 2 == 0)
   {
     *t = NULL;
     *s = nr2mInvers(a,r);
-    return (number) ((1L << res));// * (NATNUMBER) a);  // (2**res)*a    a ist Einheit
+    return (number)((1L << res)); // * (NATNUMBER) a);  // (2**res)*a    a is a unit
   }
   else
@@ -153,15 +151,15 @@
     *s = NULL;
     *t = nr2mInvers(b,r);
-    return (number) ((1L << res));// * (NATNUMBER) b);  // (2**res)*b    b ist Einheit
-  }
-}
-
-void nr2mPower (number a, int i, number * result, const coeffs r)
-{
-  if (i==0)
+    return (number)((1L << res)); // * (NATNUMBER) b);  // (2**res)*b    b is a unit
+  }
+}
+
+void nr2mPower(number a, int i, number * result, const coeffs r)
+{
+  if (i == 0)
   {
     *(NATNUMBER *)result = 1;
   }
-  else if (i==1)
+  else if (i == 1)
   {
     *result = a;
@@ -169,6 +167,6 @@
   else
   {
-    nr2mPower(a,i-1,result,r);
-    *result = nr2mMultM(a,*result,r);
+    nr2mPower(a, i-1, result, r);
+    *result = nr2mMultM(a, *result, r);
   }
 }
@@ -177,5 +175,5 @@
  * create a number from int
  */
-number nr2mInit (int i, const coeffs r)
+number nr2mInit(int i, const coeffs r)
 {
   if (i == 0) return (number)(NATNUMBER)i;
@@ -183,9 +181,9 @@
   long ii = i;
   NATNUMBER j = (NATNUMBER)1;
-  if (ii < 0) { j = r->nr2mModul; ii = -ii; }
+  if (ii < 0) { j = r->mod2mMask; ii = -ii; }
   NATNUMBER k = (NATNUMBER)ii;
-  k = k & r->nr2mModul;
-  /* now we have: from = j * k mod 2^m */
-  return (number)nr2mMult((number)j, (number)k,r);
+  k = k & r->mod2mMask;
+  /* now we have: i = j * k mod 2^m */
+  return (number)nr2mMult((number)j, (number)k, r);
 }
 
@@ -198,59 +196,56 @@
 int nr2mInt(number &n, const coeffs r)
 {
-  NATNUMBER nn = (unsigned long)(NATNUMBER)n & r->nr2mModul;
-  unsigned long l = r->nr2mModul >> 1; l++; /* now: l = 2^(m-1) */
+  NATNUMBER nn = (unsigned long)(NATNUMBER)n & r->mod2mMask;
+  unsigned long l = r->mod2mMask >> 1; l++; /* now: l = 2^(m-1) */
   if ((NATNUMBER)nn > l)
-    return (int)((NATNUMBER)nn - r->nr2mModul - 1);
+    return (int)((NATNUMBER)nn - r->mod2mMask - 1);
   else
     return (int)((NATNUMBER)nn);
 }
 
-number nr2mAdd (number a, number b, const coeffs r)
-{
-  return nr2mAddM(a,b,r);
-}
-
-number nr2mSub (number a, number b, const coeffs r)
-{
-  return nr2mSubM(a,b,r);
-}
-
-BOOLEAN nr2mIsUnit (number a, const coeffs r)
-{
-  return ((NATNUMBER) a % 2 == 1);
-}
-
-number  nr2mGetUnit (number k, const coeffs r)
-{
-  if (k == NULL)
-    return (number) 1;
-  NATNUMBER tmp = (NATNUMBER) k;
-  while (tmp % 2 == 0)
-    tmp = tmp / 2;
-  return (number) tmp;
-}
-
-BOOLEAN nr2mIsZero (number a, const coeffs r)
+number nr2mAdd(number a, number b, const coeffs r)
+{
+  return nr2mAddM(a, b, r);
+}
+
+number nr2mSub(number a, number b, const coeffs r)
+{
+  return nr2mSubM(a, b, r);
+}
+
+BOOLEAN nr2mIsUnit(number a, const coeffs r)
+{
+  return ((NATNUMBER)a % 2 == 1);
+}
+
+number nr2mGetUnit(number k, const coeffs r)
+{
+  if (k == NULL) return (number)1;
+  NATNUMBER erg = (NATNUMBER)k;
+  while (erg % 2 == 0) erg = erg / 2;
+  return (number)erg;
+}
+
+BOOLEAN nr2mIsZero(number a, const coeffs r)
 {
   return 0 == (NATNUMBER)a;
 }
 
-BOOLEAN nr2mIsOne (number a, const coeffs r)
+BOOLEAN nr2mIsOne(number a, const coeffs r)
 {
   return 1 == (NATNUMBER)a;
 }
 
-BOOLEAN nr2mIsMOne (number a, const coeffs r)
-{
-  return (r->nr2mModul  == (NATNUMBER)a) 
-        && (r->nr2mModul != 2);
-}
-
-BOOLEAN nr2mEqual (number a, number b, const coeffs r)
-{
-  return a==b;
-}
-
-BOOLEAN nr2mGreater (number a, number b, const coeffs r)
+BOOLEAN nr2mIsMOne(number a, const coeffs r)
+{
+  return (r->mod2mMask  == (NATNUMBER)a);
+}
+
+BOOLEAN nr2mEqual(number a, number b, const coeffs r)
+{
+  return a == b;
+}
+
+BOOLEAN nr2mGreater(number a, number b, const coeffs r)
 {
   return nr2mDivBy(a, b,r);
@@ -265,5 +260,5 @@
   if (a == NULL)
   {
-    NATNUMBER c = r->nr2mModul + 1;
+    NATNUMBER c = r->mod2mMask + 1;
     if (c != 0) /* i.e., if no overflow */
       return (c % (NATNUMBER)b) == 0;
@@ -291,6 +286,6 @@
 int nr2mDivComp(number as, number bs, const coeffs r)
 {
-  NATNUMBER a = (NATNUMBER) as;
-  NATNUMBER b = (NATNUMBER) bs;
+  NATNUMBER a = (NATNUMBER)as;
+  NATNUMBER b = (NATNUMBER)bs;
   assume(a != 0 && b != 0);
   while (a % 2 == 0 && b % 2 == 0)
@@ -317,8 +312,8 @@
 
 /* TRUE iff 0 < k <= 2^m / 2 */
-BOOLEAN nr2mGreaterZero (number k, const coeffs r)
+BOOLEAN nr2mGreaterZero(number k, const coeffs r)
 {
   if ((NATNUMBER)k == 0) return FALSE;
-  if ((NATNUMBER)k > ((r->nr2mModul >> 1) + 1)) return FALSE;
+  if ((NATNUMBER)k > ((r->mod2mMask >> 1) + 1)) return FALSE;
   return TRUE;
 }
@@ -328,5 +323,5 @@
    and 't' such that a * s + 2^m * t = gcd(a, 2^m) = 1;
    this code will always find a positive 's' */
-void specialXGCD(unsigned long& s, unsigned long a, const coeffs R)
+void specialXGCD(unsigned long& s, unsigned long a, const coeffs r)
 {
   int_number u = (int_number)omAlloc(sizeof(mpz_t));
@@ -339,5 +334,5 @@
   mpz_init(u2);
   int_number v = (int_number)omAlloc(sizeof(mpz_t));
-  mpz_init_set_ui(v, R->nr2mModul);
+  mpz_init_set_ui(v, r->mod2mMask);
   mpz_add_ui(v, v, 1); /* now: v = 2^m */
   int_number v0 = (int_number)omAlloc(sizeof(mpz_t));
@@ -349,13 +344,13 @@
   int_number q = (int_number)omAlloc(sizeof(mpz_t));
   mpz_init(q);
-  int_number r = (int_number)omAlloc(sizeof(mpz_t));
-  mpz_init(r);
+  int_number rr = (int_number)omAlloc(sizeof(mpz_t));
+  mpz_init(rr);
 
   while (mpz_cmp_ui(v, 0) != 0) /* i.e., while v != 0 */
   {
     mpz_div(q, u, v);
-    mpz_mod(r, u, v);
+    mpz_mod(rr, u, v);
     mpz_set(u, v);
-    mpz_set(v, r);
+    mpz_set(v, rr);
     mpz_set(u0, u2);
     mpz_set(v0, v2);
@@ -369,5 +364,5 @@
   {
     /* we add 2^m = (2^m - 1) + 1 to u1: */
-    mpz_add_ui(u1, u1, R->nr2mModul);
+    mpz_add_ui(u1, u1, r->mod2mMask);
     mpz_add_ui(u1, u1, 1);
   }
@@ -383,5 +378,5 @@
   mpz_clear(v2); omFree((ADDRESS)v2);
   mpz_clear(q); omFree((ADDRESS)q);
-  mpz_clear(r); omFree((ADDRESS)r);
+  mpz_clear(rr); omFree((ADDRESS)rr);
 }
 
@@ -395,5 +390,5 @@
 //#endif
 
-inline number nr2mInversM (number c, const coeffs r)
+inline number nr2mInversM(number c, const coeffs r)
 {
   assume((NATNUMBER)c % 2 != 0);
@@ -401,22 +396,21 @@
   NATNUMBER inv;
   inv = InvMod((NATNUMBER)c,r);
-  return (number) inv;
-}
-
-number nr2mDiv (number a, number b, const coeffs r)
-{
-  if ((NATNUMBER)a==0)
-    return (number)0;
-  else if ((NATNUMBER)b%2==0)
+  return (number)inv;
+}
+
+number nr2mDiv(number a, number b, const coeffs r)
+{
+  if ((NATNUMBER)a == 0) return (number)0;
+  else if ((NATNUMBER)b % 2 == 0)
   {
     if ((NATNUMBER)b != 0)
     {
-      while ((NATNUMBER) b%2 == 0 && (NATNUMBER) a%2 == 0)
+      while (((NATNUMBER)b % 2 == 0) && ((NATNUMBER)a % 2 == 0))
       {
-        a = (number) ((NATNUMBER) a / 2);
-        b = (number) ((NATNUMBER) b / 2);
+        a = (number)((NATNUMBER)a / 2);
+        b = (number)((NATNUMBER)b / 2);
       }
     }
-    if ((NATNUMBER) b%2 == 0)
+    if ((NATNUMBER)b % 2 == 0)
     {
       WerrorS("Division not possible, even by cancelling zero divisors.");
@@ -425,26 +419,26 @@
     }
   }
-  return (number) nr2mMult(a, nr2mInversM(b,r),r);
-}
-
-number nr2mMod (number a, number b, const coeffs R)
+  return (number)nr2mMult(a, nr2mInversM(b,r),r);
+}
+
+number nr2mMod(number a, number b, const coeffs r)
 {
   /*
-    We need to return the number r which is uniquely determined by the
+    We need to return the number rr which is uniquely determined by the
     following two properties:
-      (1) 0 <= r < |b| (with respect to '<' and '<=' performed in Z x Z)
-      (2) There exists some k in the integers Z such that a = k * b + r.
+      (1) 0 <= rr < |b| (with respect to '<' and '<=' performed in Z x Z)
+      (2) There exists some k in the integers Z such that a = k * b + rr.
     Consider g := gcd(2^m, |b|). Note that then |b|/g is a unit in Z/2^m.
     Now, there are three cases:
       (a) g = 1
           Then |b| is a unit in Z/2^m, i.e. |b| (and also b) divides a.
-          Thus r = 0.
+          Thus rr = 0.
       (b) g <> 1 and g divides a
-          Then a = (a/g) * (|b|/g)^(-1) * b (up to sign), i.e. again r = 0.
+          Then a = (a/g) * (|b|/g)^(-1) * b (up to sign), i.e. again rr = 0.
       (c) g <> 1 and g does not divide a
           Let's denote the division with remainder of a by g as follows:
           a = s * g + t. Then t = a - s * g = a - s * (|b|/g)^(-1) * |b|
-          fulfills (1) and (2), i.e. r := t is the correct result. Hence
-          in this third case, r is the remainder of division of a by g in Z.
+          fulfills (1) and (2), i.e. rr := t is the correct result. Hence
+          in this third case, rr is the remainder of division of a by g in Z.
     This algorithm is the same as for the case Z/n, except that we may
     compute the gcd of |b| and 2^m "by hand": We just extract the highest
@@ -455,6 +449,6 @@
   NATNUMBER b_div = (NATNUMBER)b;
   if (b_div < 0) b_div = -b_div; // b_div now represents |b|
-  NATNUMBER r = 0;
-  while ((g < R->nr2mModul ) && (b_div > 0) && (b_div % 2 == 0))
+  NATNUMBER rr = 0;
+  while ((g < r->mod2mMask ) && (b_div > 0) && (b_div % 2 == 0))
   {
     b_div = b_div >> 1;
@@ -462,9 +456,9 @@
   } // g is now the gcd of 2^m and |b|
 
-  if (g != 1) r = (NATNUMBER)a % g;
-  return (number)r;
-}
-
-number nr2mIntDiv (number a, number b, const coeffs r)
+  if (g != 1) rr = (NATNUMBER)a % g;
+  return (number)rr;
+}
+
+number nr2mIntDiv(number a, number b, const coeffs r)
 {
   if ((NATNUMBER)a == 0)
@@ -474,5 +468,5 @@
     if ((NATNUMBER)b == 1)
       return (number)0;
-    NATNUMBER c = r->nr2mModul + 1;
+    NATNUMBER c = r->mod2mMask + 1;
     if (c != 0) /* i.e., if no overflow */
       return (number)(c / (NATNUMBER)b);
@@ -481,5 +475,5 @@
       /* overflow: c = 2^32 resp. 2^64, depending on platform */
       int_number cc = (int_number)omAlloc(sizeof(mpz_t));
-      mpz_init_set_ui(cc, r->nr2mModul); mpz_add_ui(cc, cc, 1);
+      mpz_init_set_ui(cc, r->mod2mMask); mpz_add_ui(cc, cc, 1);
       mpz_div_ui(cc, cc, (unsigned long)(NATNUMBER)b);
       unsigned long s = mpz_get_ui(cc);
@@ -496,24 +490,24 @@
 }
 
-number  nr2mInvers (number c, const coeffs r)
-{
-  if ((NATNUMBER)c%2==0)
+number nr2mInvers(number c, const coeffs r)
+{
+  if ((NATNUMBER)c % 2 == 0)
   {
     WerrorS("division by zero divisor");
     return (number)0;
   }
-  return nr2mInversM(c,r);
-}
-
-number nr2mNeg (number c, const coeffs r)
-{
-  if ((NATNUMBER)c==0) return c;
-  return nr2mNegM(c,r);
+  return nr2mInversM(c, r);
+}
+
+number nr2mNeg(number c, const coeffs r)
+{
+  if ((NATNUMBER)c == 0) return c;
+  return nr2mNegM(c, r);
 }
 
 number nr2mMapMachineInt(number from, const coeffs src, const coeffs dst)
 {
-  NATNUMBER i = ((NATNUMBER) from) % dst->nr2mModul ;
-  return (number) i;
+  NATNUMBER i = ((NATNUMBER)from) % dst->mod2mMask ;
+  return (number)i;
 }
 
@@ -521,8 +515,8 @@
 {
   NATNUMBER j = (NATNUMBER)1;
-  long ii = (long) from;
-  if (ii < 0) { j = dst->nr2mModul; ii = -ii; }
+  long ii = (long)from;
+  if (ii < 0) { j = dst->mod2mMask; ii = -ii; }
   NATNUMBER i = (NATNUMBER)ii;
-  i = i & dst->nr2mModul;
+  i = i & dst->mod2mMask;
   /* now we have: from = j * i mod 2^m */
   return (number)nr2mMult((number)i, (number)j, dst);
@@ -531,8 +525,8 @@
 number nr2mMapQ(number from, const coeffs src, const coeffs dst)
 {
-  int_number erg = (int_number)  omAllocBin(gmp_nrz_bin);
+  int_number erg = (int_number)omAllocBin(gmp_nrz_bin);
   mpz_init(erg);
-  int_number k = (int_number) omAlloc(sizeof(mpz_t));
-  mpz_init_set_ui(k, dst->nr2mModul);
+  int_number k = (int_number)omAlloc(sizeof(mpz_t));
+  mpz_init_set_ui(k, dst->mod2mMask);
 
   nlGMP(from, (number)erg, dst);
@@ -543,13 +537,13 @@
   mpz_clear(k);   omFree((ADDRESS)k);
 
-  return (number) res;
+  return (number)res;
 }
 
 number nr2mMapGMP(number from, const coeffs src, const coeffs dst)
 {
-  int_number erg = (int_number)  omAllocBin(gmp_nrz_bin);
+  int_number erg = (int_number)omAllocBin(gmp_nrz_bin);
   mpz_init(erg);
-  int_number k = (int_number) omAlloc(sizeof(mpz_t));
-  mpz_init_set_ui(k, dst->nr2mModul);
+  int_number k = (int_number)omAlloc(sizeof(mpz_t));
+  mpz_init_set_ui(k, dst->mod2mMask);
 
   mpz_and(erg, (int_number)from, k);
@@ -559,5 +553,5 @@
   mpz_clear(k);   omFree((ADDRESS)k);
 
-  return (number) res;
+  return (number)res;
 }
 
@@ -565,5 +559,5 @@
 {
   if (nCoeff_is_Ring_2toM(src)
-     && (src->ringflagb == dst->ringflagb))
+     && (src->mod2mMask == dst->mod2mMask))
   {
     return ndCopyMap;
@@ -587,7 +581,5 @@
     return nr2mMapQ;
   }
-  if (nCoeff_is_Zp(src)
-     && (src->ch == 2)
-     && (dst->ringflagb == 1))
+  if (nCoeff_is_Zp(src) && (src->ch == 2))
   {
     return nr2mMapZp;
@@ -596,16 +588,17 @@
   {
     // Computing the n of Z/n
-    int_number modul = (int_number)  omAllocBin(gmp_nrz_bin);
-    mpz_init(modul);
-    mpz_set(modul, src->ringflaga);
-    mpz_pow_ui(modul, modul, src->ringflagb);
-    if (mpz_divisible_2exp_p(modul, dst->ringflagb))
-    {
-      mpz_clear(modul);
-      omFree((void *) modul);
+    int_number modul = (int_number)omAllocBin(gmp_nrz_bin);
+    mpz_init_set(modul, src->modNumber);
+    int_number twoToTheK = (int_number)omAllocBin(gmp_nrz_bin);
+    mpz_init_set_ui(twoToTheK, src->mod2mMask);
+    mpz_add_ui(twoToTheK, twoToTheK, 1);
+    if (mpz_divisible_p(modul, twoToTheK))
+    {
+      mpz_clear(modul);     omFree((void *)modul);
+      mpz_clear(twoToTheK); omFree((void *)twoToTheK);
       return nr2mMapGMP;
     }
-    mpz_clear(modul);
-    omFree((void *) modul);
+    mpz_clear(modul);     omFree((void *) modul);
+    mpz_clear(twoToTheK); omFree((void *)twoToTheK);
   }
   return NULL;      // default
@@ -613,5 +606,5 @@
 
 /*
- * set the exponent (allocate and init tables) (TODO)
+ * set the exponent
  */
 
@@ -620,14 +613,13 @@
   if (m > 1)
   {
-    nr2mExp = m;
-    /* we want nr2mModul to be the bit pattern '11..1' consisting
-       of m one's: */
-    r->nr2mModul = 1;
-    for (int i = 1; i < m; i++) r->nr2mModul = (r->nr2mModul * 2) + 1;
-  }
-  else
-  {
-    nr2mExp = 2;
-    r->nr2mModul = 3; /* i.e., '11' in binary representation */
+    /* we want mod2mMask to be the bit pattern
+       '111..1' consisting of m one's: */
+    r->mod2mMask = 1;
+    for (int i = 1; i < m; i++) r->mod2mMask = (r->mod2mMask << 1) + 1;
+  }
+  else
+  {
+    /* code unexpectedly called with m = 1; we go on with m = 2: */
+    r->mod2mMask = 3; /* i.e., '11' in binary representation */
   }
 }
@@ -636,5 +628,6 @@
 {
   nr2mSetExp(m, r);
-  if (m < 2) WarnS("nr2mInitExp failed: we go on with Z/2^2");
+  if (m < 2)
+    WarnS("nr2mInitExp unexpectedly called with m = 1 (we go on with Z/2^2");
 }
 
@@ -643,5 +636,5 @@
 {
   if ((NATNUMBER)a < 0) return FALSE;
-  if (((NATNUMBER)a & r->nr2mModul) != (NATNUMBER)a) return FALSE;
+  if (((NATNUMBER)a & r->mod2mMask) != (NATNUMBER)a) return FALSE;
   return TRUE;
 }
@@ -664,8 +657,8 @@
       (*i) *= 10;
       (*i) += *s++ - '0';
-      if ((*i) >= (MAX_INT_VAL / 10)) (*i) = (*i) & r->nr2mModul;
+      if ((*i) >= (MAX_INT_VAL / 10)) (*i) = (*i) & r->mod2mMask;
     }
     while (((*s) >= '0') && ((*s) <= '9'));
-    (*i) = (*i) & r->nr2mModul;
+    (*i) = (*i) & r->mod2mMask;
   }
   else (*i) = 1;
