Index: Singular/ChangeLog
===================================================================
--- Singular/ChangeLog	(revision e0fb8d31ff69374db7f865baedfda3e614804382)
+++ Singular/ChangeLog	(revision c5f63ab4be0601efd72bd46f087caac45b03f393)
@@ -1,2 +1,6 @@
+1998-03-18  Olaf Bachmann  <obachman@mathematik.uni-kl.de>
+
+	* polys-impl.h: Cleaned up COMP_FAST and related #defines
+
 1998-03-16  Olaf Bachmann  <obachman@mathematik.uni-kl.de>
 
Index: Singular/polys-impl.cc
===================================================================
--- Singular/polys-impl.cc	(revision e0fb8d31ff69374db7f865baedfda3e614804382)
+++ Singular/polys-impl.cc	(revision c5f63ab4be0601efd72bd46f087caac45b03f393)
@@ -2,5 +2,5 @@
 *  Computer Algebra System SINGULAR     *
 ****************************************/
-/* $Id: polys-impl.cc,v 1.9 1998-01-27 18:51:20 Singular Exp $ */
+/* $Id: polys-impl.cc,v 1.10 1998-03-18 14:28:48 obachman Exp $ */
 
 /***************************************************************
@@ -56,6 +56,5 @@
 #ifdef COMP_FAST
 // gets var indicies w.r.t. the ring r
-void pGetVarIndicies(ring r,
-                     int &VarOffset, int &VarCompIndex,
+void pGetVarIndicies(ring r, int &VarOffset, 
                      int &VarLowIndex, int &VarHighIndex)
 {
@@ -78,6 +77,5 @@
         case ringorder_ws:
         case ringorder_unspec:
-          pGetVarIndicies_RevLex(r->N, VarOffset, VarCompIndex,
-                                 VarLowIndex, VarHighIndex);
+          pGetVarIndicies_RevLex(r->N, VarOffset, VarLowIndex, VarHighIndex);
           break;
 
@@ -92,6 +90,5 @@
         default:
 #endif
-          pGetVarIndicies_Lex(r->N, VarOffset, VarCompIndex,
-                                 VarLowIndex, VarHighIndex);
+          pGetVarIndicies_Lex(r->N, VarOffset, VarLowIndex, VarHighIndex);
 #ifdef PDEBUG
           break;
@@ -104,5 +101,5 @@
   else
     // default var indicies are used
-    pGetVarIndicies(r->N, VarOffset, VarCompIndex, VarLowIndex, VarHighIndex);
+    pGetVarIndicies(r->N, VarOffset, VarLowIndex, VarHighIndex);
 }
 
Index: Singular/polys-impl.h
===================================================================
--- Singular/polys-impl.h	(revision e0fb8d31ff69374db7f865baedfda3e614804382)
+++ Singular/polys-impl.h	(revision c5f63ab4be0601efd72bd46f087caac45b03f393)
@@ -4,5 +4,5 @@
 *  Computer Algebra System SINGULAR     *
 ****************************************/
-/* $Id: polys-impl.h,v 1.19 1998-03-17 10:59:57 obachman Exp $ */
+/* $Id: polys-impl.h,v 1.20 1998-03-18 14:28:49 obachman Exp $ */
 
 /***************************************************************
@@ -16,5 +16,4 @@
  *
  ***************************************************************/
-#include "tok.h"
 #include "structs.h"
 #include "mmemory.h"
@@ -29,5 +28,5 @@
 typedef EXPONENT_TYPE Exponent_t;
 
-#define VARS (100)   /*max. number of variables as constant*/
+#define VARS (10)   /*max. number of variables as constant*/
 
 typedef Exponent_t  monomial[VARS + 1];
@@ -42,5 +41,4 @@
   monomial  exp; // make sure that exp is aligned
 };
-
 
 /***************************************************************
@@ -79,20 +77,20 @@
 //                               pVarLowIndex = 0,
 //                               pVarHighIndex = pVariables-1
-//                               P_COMP_INDEX = pVariables
+//                               _pCompIndex = pVariables
 // BIGENDIAN -- rev lex order
 // e_n, ... , e_2, e_1,comp,.. : pVarOffset = pVariables,
 //                               pVarLowIndex = 0,
 //                               pVarHighIndex = pVariables-1
-//                               P_COMP_INDEX = pVariables
+//                               _pCompIndex = pVariables
 // LITTLEENDIAN -- rev lex order
 // comp,.., e_1, e_2, ... , e_n : pVarOffset = #(..),
 //                                pVarLowIndex = 1 + #(..),
 //                                pVarHighIndex = #(..) + pVariables
-//                                P_COMP_INDEX = pVariables
+//                                _pCompIndex = 0
 // LITTLEENDIAN -- lex order
 // comp,..,e_n, .... , e_2, e_1 : pVarOffset = pVariables + 1 + #(..)
 //                                pVarLowIndex = 1 + #(..)
 //                                pVarHighIndex = #(..) + pVariables
-//                                P_COMP_INDEX = pVariables
+//                                _pCompIndex = 0
 //
 // Furthermore, the size of the exponent vector is always a multiple
@@ -103,5 +101,6 @@
 #ifdef WORDS_BIGENDIAN
 
-#define _pHasReverseExp    (pVarOffset != -1)
+#define _pHasReverseExp     (pVarOffset != -1)
+
 #define _pExpIndex(i)                           \
   (pVarOffset == -1 ? (i) - 1 : pVarOffset - (i))
@@ -109,7 +108,11 @@
   ((r)->VarOffset == -1 ? (i) - 1 : (r)->VarOffset - (i))
 
+#define _pCompIndex         pVariables
+#define _pRingCompIndex(r)  ((r)->N)
+
 #else // ! WORDS_BIGENDIAN
 
 #define _pHasReverseExp    (pVarOffset > (SIZEOF_LONG / SIZEOF_EXPONENT) - 1)
+
 #define _pExpIndex(i)                                   \
   (pVarOffset > (SIZEOF_LONG / SIZEOF_EXPONENT) - 1 ?   \
@@ -118,4 +121,7 @@
   ((r)->VarOffset > (SIZEOF_LONG / SIZEOF_EXPONENT) - 1 ?   \
    (r)->VarOffset - (i) : (r)->VarOffset + (i))
+
+#define _pCompIndex         0
+#define _pRingCompIndex(r)  0
 
 #endif // WORDS_BIGENDIAN
@@ -133,8 +139,9 @@
     temp = temp / sizeof(long);
   else
-    temp = (temp / sizeof(long)) + 1; // now temp == nvars1W
-  VarHighIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;
-  VarLowIndex  = VarHighIndex - nvars + 1;
-  VarOffset    = VarHighIndex + 1;
+    temp = (temp / sizeof(long)) + 1; // temp == pVariables1W
+  temp *= sizeof(long)/sizeof(Exponent_t); 
+  VarHighIndex = temp -1;
+  VarLowIndex = temp - nvars;
+  VarOffset = temp;
 #endif // WORDS_BIGENDIAN
 }
@@ -156,43 +163,31 @@
     temp = temp / sizeof(long);
   else
-    temp = (temp / sizeof(long)) + 1;
-  VarHighIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;
-  VarLowIndex  = VarHighIndex - nvars + 1;
-  VarOffset    = VarLowIndex - 1;
+    temp = (temp / sizeof(long)) + 1; // temp == pVariables1W
+  temp *= sizeof(long)/sizeof(Exponent_t); 
+  VarHighIndex = temp -1;
+  VarLowIndex = temp - nvars;
+  VarOffset = temp - nvars -1;
 #endif // WORDS_BIGENDIAN
 }
-#ifdef WORDS_BIGENDIAN
 #define pSetVarIndicies_RevLex(nvars) \
- pGetVarIndicies_RevLex(nvars,pVarOffset,pCompIndex,pVarLowIndex,pVarHighIndex)
-#else
-#define pSetVarIndicies_RevLex(nvars) \
- pGetVarIndicies_RevLex(nvars,pVarOffset,pVarLowIndex, pVarLowIndex,pVarHighIndex)
-#endif
+ pGetVarIndicies_RevLex(nvars,pVarOffset,pVarLowIndex,pVarHighIndex)
 
 // The default settings:
-inline void pGetVarIndicies(int nvars,
-                            int &VarOffset, int &VarCompIndex,
+inline void pGetVarIndicies(int nvars, int &VarOffset, 
                             int &VarLowIndex, int &VarHighIndex)
 {
-  pGetVarIndicies_Lex(nvars,VarOffset,VarCompIndex,VarLowIndex,VarHighIndex);
-}
-
+  pGetVarIndicies_Lex(nvars,VarOffset,VarLowIndex,VarHighIndex);
+}
 // gets var indicies w.r.t. the ring r
-extern void pGetVarIndicies(ring r,
-                            int &VarOffset, int &VarCompIndex,
+extern void pGetVarIndicies(ring r, int &VarOffset, 
                             int &VarLowIndex, int &VarHighIndex);
 
 #define pSetVarIndicies(nvars) \
-  pGetVarIndicies(nvars, pVarOffset, pCompIndex, pVarLowIndex, pVarHighIndex)
-
-
-#else  // ! COMP_FAST
-#define _pExpIndex(i)       (i)
-#define _pRingExpIndex(r,i) (i)
-#endif // COMP_FAST
-
-/***************************************************************
- *
- * Primitives for accessing and seeting fields of a poly
+  pGetVarIndicies(nvars, pVarOffset, pVarLowIndex, pVarHighIndex)
+
+
+/***************************************************************
+ *
+ * Primitives for accessing and setting fields of a poly
  *
  ***************************************************************/
@@ -204,9 +199,5 @@
 #define _pSetCoeff0(p,n)    (p)->coef=n
 
-#ifndef TEST_MAC_DEBUG
 #define _pGetOrder(p)       ((p)->Order)
-#else
-#define _pGetOrder(p)       ((p)->MOrder)
-#endif
 
 #if defined(PDEBUG) && PDEBUG != 0
@@ -259,19 +250,39 @@
 }
 
-#define _pSetComp(p,k)      (p)->exp[pCompIndex] = (k)
-#define _pGetComp(p)        (p)->exp[pCompIndex]
-#define _pIncrComp(p)       (p)->exp[pCompIndex]++
-#define _pDecrComp(p)       (p)->exp[pCompIndex]--
-#define _pAddComp(p,v)      (p)->exp[pCompIndex] += (v)
-#define _pSubComp(p,v)      (p)->exp[pCompIndex] -= (v)
-
-#ifdef COMP_FAST
-#define _pRingSetComp(r,p,k)      (p)->exp[(r)->CompIndex] = (k)
-#define _pRingGetComp(r,p)        (p)->exp[(r)->CompIndex]
-#else
-#define _pRingSetComp(r,p,k)      _pSetComp(p,k)
-#define _pRingGetComp(r,p)        _pGetComp(p)
-#endif
-
+#define _pSetComp(p,k)      (p)->exp[_pCompIndex] = (k)
+#define _pGetComp(p)        (p)->exp[_pCompIndex]
+#define _pIncrComp(p)       (p)->exp[_pCompIndex]++
+#define _pDecrComp(p)       (p)->exp[_pCompIndex]--
+#define _pAddComp(p,v)      (p)->exp[_pCompIndex] += (v)
+#define _pSubComp(p,v)      (p)->exp[_pCompIndex] -= (v)
+
+#define _pRingSetComp(r,p,k)      (p)->exp[_pRingCompIndex(r)] = (k)
+#define _pRingGetComp(r,p)        (p)->exp[_pRingCompIndex(r)]
+
+inline void _pGetExpV(poly p, Exponent_t *ev)
+{
+  if (_pHasReverseExp)
+  {
+    for (int i = pVarLowIndex, j = pVariables; j; i++, j--)
+      ev[j] = p->exp[i];
+  }
+  else
+    memcpy(&ev[1], &(p->exp[pVarLowIndex]), pVariables*sizeof(Exponent_t));
+  ev[0] = _pGetComp(p);
+}
+
+extern pSetmProc pSetm;
+inline void _pSetExpV(poly p, Exponent_t *ev)
+{
+  if (_pHasReverseExp)
+  {
+    for (int i = pVarLowIndex, j = pVariables; j; i++, j--)
+      p->exp[i] = ev[j];
+  }
+  else
+    memcpy(&(p->exp[pVarLowIndex]), &ev[1], pVariables*sizeof(Exponent_t));
+  _pSetComp(p, ev[0]);
+  pSetm(p);
+}
 
 /***************************************************************
@@ -316,9 +327,5 @@
 #define _pHead(A)       pDBHead(A,__FILE__,__LINE__)
 #define _pHead0(A)      pDBHead0(A, __FILE__,__LINE__)
-#ifdef COMP_FAST
 #define _pFetchCopy(r,A)    pDBFetchCopy(r, A,__FILE__,__LINE__)
-#else
-#define _pFetchCopy(r,p)    pOrdPolyInsertSetm(pCopy(p))
-#endif
 
 #else // ! PDEBUG
@@ -328,9 +335,7 @@
 #else
 #define _pNew()         (poly) mmAllocSpecialized()
-// #define _pNew() _pInit()
 #endif
 
 #include <string.h>
-
 inline poly    _pInit(void)
 {
@@ -356,20 +361,21 @@
 extern poly    _pHead(poly a);
 extern poly    _pHead0(poly a);
-#ifdef COMP_FAST
 extern poly    _pFetchCopy(ring r,poly a);
-#else
-#define _pFetchCopy(r,p)  pOrdPolyInsertSetm(pCopy(p))
-#endif
-
 #endif // PDEBUG
 
 #define _pCopy2(p1, p2)     memcpyW(p1, p2, pMonomSizeW)
 
+/***************************************************************
+ *
+ * Routines which work on vectors instead of single exponents
+ *
+ ***************************************************************/
 // Here is a handy Macro which disables inlining when run with
 // profiling and enables it otherwise
 
-#ifdef DO_PROFILE
+#ifdef DO_DEEP_PROFILE
 
 #ifndef POLYS_IMPL_CC
+
 #define DECLARE(type, arglist) type arglist; \
    static type dummy_##arglist
@@ -378,26 +384,17 @@
 #endif // POLYS_IMPL_CC
 
-#else //! DO_PROFILE
+#else //! DO_DEEP_PROFILE
 
 #define DECLARE(type, arglist ) inline type arglist
 
-#endif // DO_PROFILE
-
-
-/***************************************************************
- *
- * Routines which work on vectors instead of single exponents
- *
- ***************************************************************/
-
-#ifdef COMP_FAST
-
-// nice declaration isn't it ??
+#endif // DO_DEEP_PROFILE
+
+
 #if defined(PDEBUG) && PDEBUG == 1
-#define pMonAddFast(p1, p2)  pDBMonAddFast(p1, p2, __FILE__, __LINE__)
+#define _pMonAddFast(p1, p2)  pDBMonAddFast(p1, p2, __FILE__, __LINE__)
 extern  void pDBMonAddFast(poly p1, poly p2, char* f, int l);
-inline void _pMonAddFast(poly p1, poly p2)
-#else
-  DECLARE(void, pMonAddFast(poly p1, poly p2))
+inline void __pMonAddFast(poly p1, poly p2)
+#else
+  DECLARE(void, _pMonAddFast(poly p1, poly p2))
 #endif // defined(PDEBUG) && PDEBUG == 1
 {
@@ -406,5 +403,4 @@
   // positive and the sum of two exponents does not exceed
   // EXPONENT_MAX
-#ifndef COMP_NO_EXP_VECTOR_OPS
   Exponent_t c2 = _pGetComp(p2);
   int i = pVariables1W;
@@ -413,9 +409,4 @@
   // set comp of p2 temporarily to 0, so that nothing is added to comp of p1
   _pSetComp(p2, 0);
-#else
-  int i = pVariables;
-  Exponent_pt s1 = &(p1->exp[pVarLowIndex]);
-  Exponent_pt s2 = &(p2->exp[pVarLowIndex]);
-#endif
 
   for (;;)
@@ -427,11 +418,6 @@
     s2++;
   }
-#ifndef COMP_NO_EXP_VECTOR_OPS
   // reset comp of p2
   _pSetComp(p2, c2);
-#endif
-#ifdef TEST_MAC_ORDER
-  if (bNoAdd) bSetm(p1);else
-#endif
   _pGetOrder(p1) += _pGetOrder(p2);
 }
@@ -446,26 +432,11 @@
 #endif // defined(PDEBUG) && PDEBUG == 1
 {
-  p1->next = p2->next;
-  p1->coef = p2->coef;
-//  memset(p1, 0, pMonomSize);
-
-  //memset(p1,0,pMonomSize);
-#ifndef COMP_NO_EXP_VECTOR_OPS
   unsigned long* s1 = (unsigned long*) &(p1->exp[0]);
   const unsigned long* s2 = (unsigned long*) &(p2->exp[0]);
   const unsigned long* s3 = (unsigned long*) &(p3->exp[0]);
   const unsigned long* const ub = s3 + pVariables1W;
-#else
-  Exponent_t* s1 = (Exponent_t*) &(p1->exp[pVarLowIndex]);
-  const Exponent_t* s2 = (Exponent_t*) &(p2->exp[pVarLowIndex]);
-  const Exponent_t* s3 = (Exponent_t*) &(p3->exp[pVarLowIndex]);
-  const Exponent_t* const ub = s3 + pVariables;
-// need to zero the "fill in" slots (i.e., empty exponents)
-#ifdef  WORDS_BIGENDIAN
-  *((unsigned long *) ((unsigned long*) p1) + pMonomSizeW -1) = 0;
-#else
-  *((unsigned long *) p1->exp) = 0;
-#endif
-#endif
+
+  p1->next = p2->next;
+  p1->coef = p2->coef;
 
   for (;;)
@@ -480,36 +451,22 @@
   // component of p1 is set to comp of p2
   _pSetComp(p1, _pGetComp(p2));
-  #ifdef TEST_MAC_ORDER
-  if (bNoAdd) bSetm(p1);else
-  #endif
   _pGetOrder(p1) = _pGetOrder(p2) + _pGetOrder(p3);
 }
 
-// Similar to pCopyAddFast, except that we assume that the component
-// of p2 and p3 is zero component
+// Similar to pCopyAddFast, except that we do not care about the "next" field
 #if defined(PDEBUG) && PDEBUG == 1
-#define _pCopyAddFast1(p1, p2, p3)  pDBCopyAddFast(p1, p2, p3, __FILE__, __LINE__)
+#define _pCopyAddFast0(p1, p2, p3)  pDBCopyAddFast(p1, p2, p3, __FILE__, __LINE__)
 extern  void pDBCopyAddFast(poly p1, poly p2, poly p3, char* f, int l);
-inline void __pCopyAddFast1(poly p1, poly p2, poly p3)
-#else
-  DECLARE(void, _pCopyAddFast1(poly p1, poly p2, poly p3))
+inline void __pCopyAddFast0(poly p1, poly p2, poly p3)
+#else
+  DECLARE(void, _pCopyAddFast0(poly p1, poly p2, poly p3))
 #endif // defined(PDEBUG) && PDEBUG == 1
 {
-#ifndef COMP_NO_EXP_VECTOR_OPS
   unsigned long* s1 = (unsigned long*) &(p1->exp[0]);
   const unsigned long* s2 = (unsigned long*) &(p2->exp[0]);
   const unsigned long* s3 = (unsigned long*) &(p3->exp[0]);
   const unsigned long* const ub = s3 + pVariables1W;
-#else
-  Exponent_t* s1 = (Exponent_t*) &(p1->exp[pVarLowIndex]);
-  const Exponent_t* s2 = (Exponent_t*) &(p2->exp[pVarLowIndex]);
-  const Exponent_t* s3 = (Exponent_t*) &(p3->exp[pVarLowIndex]);
-  const Exponent_t* const ub = s3 + pVariables;
-#ifdef  WORDS_BIGENDIAN
-  *((unsigned long *) ((unsigned long*) p1) + pMonomSizeW -1) = 0;
-#else
-  *((unsigned long *) p1->exp) = 0;
-#endif
-#endif
+
+  p1->coef = p2->coef;
 
   for (;;)
@@ -521,12 +478,7 @@
     s2++;
   }
-  #ifdef TEST_MAC_ORDER
-  if (bNoAdd) bSetm(p1);else
-  #endif
+  _pSetComp(p1, _pGetComp(p2));
   _pGetOrder(p1) = _pGetOrder(p2) + _pGetOrder(p3);
 }
-
-
-#ifndef COMP_NO_EXP_VECTOR_OPS
 
 #if SIZEOF_LONG == 4
@@ -579,38 +531,4 @@
 }
 
-#else //  ! COMP_NO_EXP_VECTOR_OPS
-
-DECLARE(BOOLEAN, __pDivisibleBy(poly a, poly b))
-{
-#ifdef WORDS_BIGENDIAN
-  const Exponent_t* s1 = &(a->exp[pVarHighIndex]);
-  const Exponent_t* s2 = &(b->exp[pVarHighIndex]);
-  const Exponent_t* lb = s1 - pVariables;
-
-  for (;;)
-  {
-    if (*s1 > *s2) return FALSE;
-    s1--;
-    if (s1 == lb) return TRUE;
-    s2--;
-  }
-
-#else // !WORDS_BIGENDIAN
-  const Exponent_t* s1 = &(a->exp[pVarLowIndex]);
-  const Exponent_t* s2 = &(b->exp[pVarLowIndex]);
-  const Exponent_t* lb = s1 + pVariables;
-
-  for (;;)
-  {
-   if (*s1 > *s2) return FALSE;
-   s1++;
-   if (s1 == lb) return TRUE;
-   s2++;
-  }
-#endif  // WORDS_BIGENDIAN
-}
-
-#endif //  COMP_NO_EXP_VECTOR_OPS
-
 #if defined(PDEBUG) && PDEBUG == 1
 #define _pDivisibleBy(a,b)   pDBDivisibleBy(a, b, __FILE__, __LINE__)
@@ -651,14 +569,7 @@
 DECLARE(BOOLEAN, _pEqual(poly p1, poly p2))
 {
-#ifndef COMP_NO_EXP_VECTOR_OPS
   const long *s1 = (long*) &(p1->exp[0]);
   const long *s2 = (long*) &(p2->exp[0]);
   const long* const lb = s1 + pVariables1W;
-#else
-  const Exponent_t *s1 = (Exponent_t*) &(p1->exp[pVarLowIndex]);
-  const Exponent_t *s2 = (Exponent_t*) &(p2->exp[pVarLowIndex]);
-  const Exponent_t* const lb = s1 + pVariables;
-  if (_pGetComp(p1) != _pGetComp(p2)) return FALSE;
-#endif
 
   for(;;)
@@ -671,90 +582,8 @@
 }
 
-inline void _pGetExpV(poly p, Exponent_t *ev)
-{
-  if (_pHasReverseExp)
-  {
-    for (int i = pVarLowIndex, j = pVariables; j; i++, j--)
-      ev[j] = p->exp[i];
-  }
-  else
-    memcpy(&ev[1], &(p->exp[pVarLowIndex]), pVariables*sizeof(Exponent_t));
-  ev[0] = _pGetComp(p);
-}
-
-extern pSetmProc pSetm;
-inline void _pSetExpV(poly p, Exponent_t *ev)
-{
-  if (_pHasReverseExp)
-  {
-    for (int i = pVarLowIndex, j = pVariables; j; i++, j--)
-      p->exp[i] = ev[j];
-  }
-  else
-    memcpy(&(p->exp[pVarLowIndex]), &ev[1], pVariables*sizeof(Exponent_t));
-  _pSetComp(p, ev[0]);
-  pSetm(p);
-}
-
-#else // ! COMP_FAST
-
-DECLARE(BOOLEAN, _pDivisibleBy(poly a, poly b))
-{
-  if ((a!=NULL)&&((a->exp[0]==0) || (a->exp[0] == b->exp[0])))
-  {
-    int i=pVariables;
-    short *e1=&(a->exp[1]);
-    short *e2=&(b->exp[1]);
-    if ((*e1) > (*e2)) return FALSE;
-    do
-    {
-      i--;
-      if (i == 0) return TRUE;
-      e1++;
-      e2++;
-    } while ((*e1) <= (*e2));
-  }
-  return FALSE;
-}
-
-#define _pDivisibleBy1(a,b) _pDivisibleBy(a,b)
-#define _pDivisibleBy2(a,b) _pDivisibleBy(a,b)
-
-#ifdef TEST_MAC_ORDER
-DECLARE(void, pMonAddFast(poly a, poly m))
-{
-  for(int ii =pVariables; ii; ii--) (a)->exp[ii] += (m)->exp[ii];\
-  if (bNoAdd) bSetm(a); else
-  _pGetOrder(a) += _pGetOrder(m);
-}
-#else
-DECLARE(void, pMonAddFast(poly a, poly m))
-{
-  for(int ii =pVariables; ii; ii--) (a)->exp[ii] += (m)->exp[ii];\
-  _pGetOrder(a) += _pGetOrder(m);
-}
-#endif
-
-DECLARE(BOOLEAN, _pEqual(poly p1, poly p2))
-{
-  int i;
-  short *e1=p1->exp;
-  short *e2=p2->exp;
-
-  if (p1->Order != p2->Order) return FALSE;
-  for (i=pVariables; i>=0; i--,e1++,e2++)
-    if (*e1 != *e2) return FALSE;
-  return TRUE;
-}
-
-#define _pGetExpV(p,e)    memcpy((e),(p)->exp,(pVariables+1)*sizeof(short));
-//void    pSetExpV(poly p, short * exp);
-#define _pSetExpV(p,e) {memcpy((p)->exp,(e),(pVariables+1)*sizeof(short));pSetm(p);}
-
-#endif // COMP_FAST
-
-/***************************************************************
- *
- * Routines which implement low-level manipulations/operations on exponents
+/***************************************************************
+ *
+ * Routines which implement low-level manipulations/operations 
+ * on exponents and "are allowed" to access single exponetns
  *
  ***************************************************************/
@@ -773,281 +602,16 @@
 }
 
-#ifdef COMP_FAST
 #define _pExpQuerSum(p)  __pExpQuerSum2(p, pVarLowIndex, pVarHighIndex)
 
-#define _pExpQuerSum1(p,to) \
- (_pHasReverseExp ? \
-    __pExpQuerSum2(p, _pExpIndex(to), _pExpIndex(1)) : \
+#define _pExpQuerSum1(p,to)                             \
+ (_pHasReverseExp ?                                     \
+    __pExpQuerSum2(p, _pExpIndex(to), _pExpIndex(1)) :  \
     __pExpQuerSum2(p, _pExpIndex(1), _pExpIndex(to)))
 
-#define _pExpQuerSum2(p,from,to) \
- (_pHasReverseExp ? \
-    __pExpQuerSum2(p, _pExpIndex(to), _pExpIndex(from)) : \
+#define _pExpQuerSum2(p,from,to)                            \
+ (_pHasReverseExp ?                                         \
+    __pExpQuerSum2(p, _pExpIndex(to), _pExpIndex(from)) :   \
     __pExpQuerSum2(p, _pExpIndex(from), _pExpIndex(to)))
-#else
-
-#define _pExpQuerSum(p)             __pExpQuerSum2(p, 1, pVariables)
-#define _pExpQuerSum1(p, to)        __pExpQuerSum2(p, 1, to)
-#define _pExpQuerSum2(p, from, to)  __pExpQuerSum2(p, from, to)
-
-#endif
-
-/***************************************************************
- *
- * Routines which implement macaulay ordering routines
- *
- ***************************************************************/
-#ifdef TEST_MAC_ORDER
-
-DECLARE(void, _bSetm0(poly p))
-{
-
-  int i=1;
-  int ord = -INT_MAX;
-  Exponent_t *ep;
-
-#ifdef COMP_FAST
-  if(_pHasReverseExp)
-  {
-    ep=&(p->exp[pVarHighIndex]);
-    int *ip=bBinomials+(*ep); /*_pGetExp(p,1);*/
-    loop
-    {
-      ord += (*ip);
-      if (i==pVariables) break;
-      i++;
-      //ip+=bHighdeg_1+_pGetExp(p,i);
-      ep--;
-      ip+=bHighdeg_1+(*ep);
-    }
-  }
-  else
-  {
-    ep=&(p->exp[pVarLowIndex]);
-    int *ip=bBinomials+(*ep); /*_pGetExp(p,1);*/
-    loop
-    {
-      ord += (*ip);
-      if (i==pVariables) break;
-      i++;
-      //ip+=bHighdeg_1+_pGetExp(p,i);
-      ep++;
-      ip+=bHighdeg_1+(*ep);
-    }
-  }
-  #ifdef TEST_MAC_DEBUG
-  p->Order=_pExpQuerSum(p);
-  p->MOrder=ord;
-  #else
-  p->Order=ord;
-  #endif
-#else
-    int *ip=bBinomials+_pGetExp(p,1);
-    loop
-    {
-      ord += (*ip);
-      if (i==pVariables) break;
-      i++;
-      ip+=bHighdeg_1+_pGetExp(p,i);
-    }
-  #ifdef TEST_MAC_DEBUG
-  p->Order=pTotaldegree(p);
-  p->MOrder=ord;
-  #else
-  p->Order=ord;
-  #endif
-#endif
-}
-
-DECLARE(void, _bSetm(poly p))
-{
-  int ord = _pExpQuerSum(p);
-
-  if (ord<bHighdeg)
-    _bSetm0(p);
-  else
-  {
-  #ifdef TEST_MAC_DEBUG
-    p->MOrder=ord;
-  #endif
-    p->Order=ord;
-  }
-}
-
-#ifdef COMP_FAST
-// ordering dp,c or c,dp, general case
-#if defined(PDEBUG) && PDEBUG == 1
-#define pbMonAddFast(p1, p2)  pDBMonAddFast(p1, p2, __FILE__, __LINE__)
-extern  void pbDBMonAddFast(poly p1, poly p2, char* f, int l);
-inline void _pbMonAddFast(poly p1, poly p2)
-#else
-#define pbMonAddFast(p1, p2)  _pbMonAddFast(p1, p2)
-DECLARE(void, _pbMonAddFast(poly p1, poly p2))
-#endif // defined(PDEBUG) && PDEBUG == 1
-{
-  // OK -- this might be the only place where we are kind of quick and
-  // dirty: the following only works correctly if all exponents are
-  // positive and the sum of two exponents does not exceed
-  // EXPONENT_MAX
-#ifndef COMP_NO_EXP_VECTOR_OPS
-  Exponent_t c2 = _pGetComp(p2);
-  int i = pVariables1W;
-  unsigned long* s1 = (unsigned long*) &(p1->exp[0]);
-  const unsigned long* s2 = (unsigned long*) &(p2->exp[0]);
-  // set comp of p2 temporarily to 0, so that nothing is added to comp of p1
-  _pSetComp(p2, 0);
-#else
-  int i = pVariables;
-  Exponent_pt s1 = &(p1->exp[pVarLowIndex]);
-  Exponent_pt s2 = &(p2->exp[pVarLowIndex]);
-#endif
-
-  for (;;)
-  {
-    *s1 += *s2;
-    i--;
-    if (i==0) break;
-    s1++;
-    s2++;
-  }
-#ifndef COMP_NO_EXP_VECTOR_OPS
-  // reset comp of p2
-  _pSetComp(p2, c2);
-#endif
-  if ((_pGetOrder(p1)|_pGetOrder(p2))>0) // i.e. overflow of mac order
-    _pGetOrder(p1) += _pGetOrder(p2);
-  else
-    _bSetm(p1);
-}
-
-// ordering dp,c or c,dp, below degree limit
-#if defined(PDEBUG) && PDEBUG == 1
-#define pbMonAddFast0(p1, p2)  pbDBMonAddFast0(p1, p2, __FILE__, __LINE__)
-extern  void pbDBMonAddFast0(poly p1, poly p2, char* f, int l);
-inline void _pbMonAddFast0(poly p1, poly p2)
-#else
-  DECLARE(void, pbMonAddFast0(poly p1, poly p2))
-#endif // defined(PDEBUG) && PDEBUG == 1
-{
-  // OK -- this might be the only place where we are kind of quick and
-  // dirty: the following only works correctly if all exponents are
-  // positive and the sum of two exponents does not exceed
-  // EXPONENT_MAX
-#ifndef COMP_NO_EXP_VECTOR_OPS
-  Exponent_t c2 = _pGetComp(p2);
-  int i = pVariables1W;
-  unsigned long* s1 = (unsigned long*) &(p1->exp[0]);
-  const unsigned long* s2 = (unsigned long*) &(p2->exp[0]);
-  // set comp of p2 temporarily to 0, so that nothing is added to comp of p1
-  _pSetComp(p2, 0);
-#else
-  int i = pVariables;
-  Exponent_pt s1 = &(p1->exp[pVarLowIndex]);
-  Exponent_pt s2 = &(p2->exp[pVarLowIndex]);
-#endif
-
-  for (;;)
-  {
-    *s1 += *s2;
-    i--;
-    if (i==0) break;
-    s1++;
-    s2++;
-  }
-#ifndef COMP_NO_EXP_VECTOR_OPS
-  // reset comp of p2
-  _pSetComp(p2, c2);
-#endif
-  _bSetm0(p1);
-}
-
-// ordering dp,c or c,dp, below degree limit
-// Makes p1 a copy of p2 and adds on exponets of p3
-#if defined(PDEBUG) && PDEBUG == 1
-#define _pbCopyAddFast0(p1, p2, p3)  pDBCopyAddFast(p1, p2, p3, __FILE__, __LINE__)
-inline void __pbCopyAddFast0(poly p1, poly p2, poly p3)
-#else
-  DECLARE(void, _pbCopyAddFast0(poly p1, poly p2, poly p3))
-#endif // defined(PDEBUG) && PDEBUG == 1
-{
-  p1->next = p2->next;
-  p1->coef = p2->coef;
-
-#ifndef COMP_NO_EXP_VECTOR_OPS
-  unsigned long* s1 = (unsigned long*) &(p1->exp[0]);
-  const unsigned long* s2 = (unsigned long*) &(p2->exp[0]);
-  const unsigned long* s3 = (unsigned long*) &(p3->exp[0]);
-  const unsigned long* const ub = s3 + pVariables1W;
-#else
-  Exponent_t* s1 = (Exponent_t*) &(p1->exp[pVarLowIndex]);
-  const Exponent_t* s2 = (Exponent_t*) &(p2->exp[pVarLowIndex]);
-  const Exponent_t* s3 = (Exponent_t*) &(p3->exp[pVarLowIndex]);
-  const Exponent_t* const ub = s3 + pVariables;
-// need to zero the "fill in" slots (i.e., empty exponents)
-#ifdef  WORDS_BIGENDIAN
-  *((unsigned long*) p1 + pMonomSizeW -1) = 0;
-#else
-  *((unsigned long *) p1->exp) = 0;
-#endif
-#endif
-
-  for (;;)
-  {
-    *s1 = *s2 + *s3;
-    s3++;
-    if (s3 == ub) break;
-    s1++;
-    s2++;
-  }
-  // we first are supposed to do a copy from p2 to p1 -- therefore,
-  // component of p1 is set to comp of p2
-  _pSetComp(p1, _pGetComp(p2));
-  _bSetm0(p1);
-}
-
-// Similar to pCopyAddFast, except that we assume that the component
-// of p2 and p3 is zero component
-#if defined(PDEBUG) && PDEBUG == 1
-#define _pbCopyAddFast10(p1, p2, p3)  pbDBCopyAddFast0(p1, p2, p3, __FILE__, __LINE__)
-extern  void pbDBCopyAddFast0(poly p1, poly p2, poly p3, char* f, int l);
-inline void __pbCopyAddFast10(poly p1, poly p2, poly p3)
-#else
-  DECLARE(void, _pbCopyAddFast10(poly p1, poly p2, poly p3))
-#endif // defined(PDEBUG) && PDEBUG == 1
-{
-  p1->next = p2->next;
-  p1->coef = p2->coef;
-
-#ifndef COMP_NO_EXP_VECTOR_OPS
-  unsigned long* s1 = (unsigned long*) &(p1->exp[0]);
-  const unsigned long* s2 = (unsigned long*) &(p2->exp[0]);
-  const unsigned long* s3 = (unsigned long*) &(p3->exp[0]);
-  const unsigned long* const ub = s3 + pVariables1W;
-#else
-  Exponent_t* s1 = (Exponent_t*) &(p1->exp[pVarLowIndex]);
-  const Exponent_t* s2 = (Exponent_t*) &(p2->exp[pVarLowIndex]);
-  const Exponent_t* s3 = (Exponent_t*) &(p3->exp[pVarLowIndex]);
-  const Exponent_t* const ub = s3 + pVariables;
-#ifdef  WORDS_BIGENDIAN
-  *((unsigned long*) p1 + pMonomSizeW -1) = 0;
-#else
-  *((unsigned long *) p1->exp) = 0;
-#endif
-#endif
-
-  for (;;)
-  {
-    *s1 = *s2 + *s3;
-    s3++;
-    if (s3 == ub) break;
-    s1++;
-    s2++;
-  }
-  _bSetm0(p1);
-}
-
-#endif
-#endif
-
+
+#define COMP_FAST
 #endif // POLYS_IMPL_H
-
Index: Singular/polys.cc
===================================================================
--- Singular/polys.cc	(revision e0fb8d31ff69374db7f865baedfda3e614804382)
+++ Singular/polys.cc	(revision c5f63ab4be0601efd72bd46f087caac45b03f393)
@@ -2,5 +2,5 @@
 *  Computer Algebra System SINGULAR     *
 ****************************************/
-/* $Id: polys.cc,v 1.16 1998-03-16 14:56:39 obachman Exp $ */
+/* $Id: polys.cc,v 1.17 1998-03-18 14:28:50 obachman Exp $ */
 
 /*
@@ -415,6 +415,4 @@
 #ifdef COMP_TRADITIONAL
 
-pCompProc t_pComp0;
-
 static int t_comp_otCOMPEXP_nwONE(poly p1, poly p2);
 static int t_comp_otEXPCOMP_nwONE(poly p1, poly p2);
@@ -999,11 +997,6 @@
       for (i=indexShift;i<maxSchreyer;i++)
         SchreyerOrd[i] = pGetComp(nextOrder[i-indexShift]);
-#ifdef COMP_DEBUG      
-      pCompOld = t_pComp0;
-#else
       pCompOld = pComp0;
-#endif      
       pComp0 = mcompSchrM;
-      t_pComp0 = mcompSchrM;
       pLDegOld = pLDeg;
       pLDeg = ldegSchrM;
@@ -1017,10 +1010,5 @@
       maxSchreyer = 0;
       indexShift = 0;
-#ifdef COMP_DEBUG
-      pComp0 = debug_comp;
-#else
       pComp0 = pCompOld;
-#endif      
-      t_pComp0 = pCompOld;
       pLDeg = pLDegOld;
     }
@@ -1052,13 +1040,6 @@
     if (maxBound==0)
     {
-#ifdef COMP_DEBUG
-      pCompOld = t_pComp0;
-      pComp0 = mcompSyz;
-      t_pComp0 = mcompSyz;
-#else
       pCompOld = pComp0;
       pComp0 = mcompSyz;
-      t_pComp0 = mcompSyz;
-#endif
     }
     maxBound = k;
@@ -1068,10 +1049,5 @@
     if (maxBound!=0)
     {
-#ifdef COMP_DEBUG
-      pComp0 = debug_comp;
-#else
       pComp0 = pCompOld;
-#endif      
-      t_pComp0 = pCompOld;
       maxBound = 0;
     }
@@ -1294,51 +1270,4 @@
 #endif  
 {
-#ifdef COMP_TRADITIONAL
-  if (pVariables <= 1)
-  {
-    t_pComp0 = t_comp_otEXPCOMP_nwONE;
-  }
-  else
-  {
-    switch(o_r)
-    {
-        case ringorder_lp:
-        case ringorder_Dp:
-        case ringorder_Wp:
-        case ringorder_Ds:
-        case ringorder_Ws:
-        case ringorder_ls:
-          t_pComp0 = t_comp_otEXPCOMP_lex_i;
-          pLexSgn = 1;
-          break;
-
-#ifdef PDEBUG
-        case ringorder_unspec:
-        case ringorder_dp:
-        case ringorder_wp:
-        case ringorder_ds:
-        case ringorder_ws:
-#else
-        default:
-#endif      
-          t_pComp0 = t_comp_otEXPCOMP_revlex_i;
-          pLexSgn = -1;
-          break;
-#ifdef PDEBUG
-        default:
-          Werror("wrong internal ordering:%d at %s, l:%d\n",o_r,__FILE__,__LINE__);
-#endif
-    }
-  }
-  if (o_r == ringorder_lp || o_r == ringorder_ls)
-  {
-      pLexOrder=TRUE;
-      pFDeg = pTotaldegree;
-      pLDeg = ldeg1c;
-      if (o_r == ringorder_ls) pLexSgn = -1;
-  }
-  
-  *p = t_pComp0;
-#endif
 #ifdef COMP_FAST
   switch(o_r)
@@ -1427,7 +1356,4 @@
 #endif // COMP_FAST  
 
-#ifdef COMP_DEBUG
-    *p = debug_comp;
-#endif  
 }
 
@@ -1485,51 +1411,4 @@
 #endif  
 {
-#ifdef COMP_TRADITIONAL
-  if (pVariables <= 1)
-  {
-    t_pComp0 = t_comp_otCOMPEXP_nwONE;
-  }
-  else
-  {
-    switch(o_r)
-    {
-        case ringorder_lp:
-        case ringorder_Dp:
-        case ringorder_Wp:
-        case ringorder_Ds:
-        case ringorder_Ws:
-        case ringorder_ls:
-          t_pComp0 = t_comp_lex_otCOMPEXP_i;
-          pLexSgn = 1;
-          break;
-
-#ifdef PDEBUG
-        case ringorder_unspec:
-        case ringorder_dp:
-        case ringorder_wp:
-        case ringorder_ds:
-        case ringorder_ws:
-#else
-        default:
-#endif      
-          t_pComp0 = t_comp_revlex_otCOMPEXP_i;
-          pLexSgn = -1;
-          break;
-#ifdef PDEBUG
-        default:
-          Werror("wrong internal ordering:%d at %s, l:%d\n",o_r,__FILE__,__LINE__);
-#endif
-    }
-  }
-  if (o_r == ringorder_lp || o_r == ringorder_ls)
-  {
-      pLexOrder=TRUE;
-      pFDeg = pTotaldegree;
-      pLDeg = ldeg1c;
-      if (o_r == ringorder_ls) pLexSgn = -1;
-  }
-  
-  *p = t_pComp0;
-#endif
 #ifdef COMP_FAST
   switch(o_r)
@@ -1950,5 +1829,4 @@
   pAltVars=r->N+1;
 #endif
-  t_pComp0 = NULL;
 #ifdef COMP_FAST
   f_pComp0 = NULL;
@@ -2077,8 +1955,4 @@
     test &= ~Sy_bit(OPT_REDTAIL); /* noredTail */
   }
-#ifdef COMP_TRADITIONAL  
-  if (t_pComp0 == NULL)
-    t_pComp0 = pComp0;
-#endif
 
 #ifdef COMP_FAST
@@ -3124,19 +2998,4 @@
 }
 
-#ifdef COMP_DEBUG
-static int debug_comp(poly p1, poly p2)
-{
-  int t_d = t_pComp0(p1, p2);
-  int f_d = f_pComp0(p1, p2);
-
-  if (t_d != f_d)
-  {
-    fprintf(stderr, "Error in comp1lpc\n");
-    t_pComp0(p1, p2);
-    f_pComp0(p1, p2);
-  }
-  return t_d;
-}
-#endif
 
 #ifdef COMP_STATISTICS
Index: Singular/polys.h
===================================================================
--- Singular/polys.h	(revision e0fb8d31ff69374db7f865baedfda3e614804382)
+++ Singular/polys.h	(revision c5f63ab4be0601efd72bd46f087caac45b03f393)
@@ -4,5 +4,5 @@
 *  Computer Algebra System SINGULAR     *
 ****************************************/
-/* $Id: polys.h,v 1.9 1998-01-17 18:08:00 Singular Exp $ */
+/* $Id: polys.h,v 1.10 1998-03-18 14:28:52 obachman Exp $ */
 /*
 * ABSTRACT - all basic methods to manipulate polynomials
@@ -186,10 +186,11 @@
 
 
+// Adds exponents of p2 to exponents of p1; updates Order field
+// assumes that exponents > 0 and < MAX_EXPONENT / 2
+#define pMonAddFast(p1, p2) _pMonAddFast(p1, p2)
 // Is equivalent to pCopy2(p1, p2);pMonAddFast(p1, p3);
 #define pCopyAddFast(p1, p2, p3)    _pCopyAddFast(p1, p2, p3)
-#define pbCopyAddFast(p1, p2, p3)   _pbCopyAddFast(p1, p2, p3)
-#define pbCopyAddFast0(p1, p2, p3)  _pbCopyAddFast0(p1, p2, p3)
-// Similar to pCopyAddFast, except that components of p2, and p3 must be 0
-#define pCopyAddFast1(p1, p2, p3)    _pCopyAddFast1(p1, p2, p3)
+// Similar to pCopyAddFast, except that we do not care about the next field
+#define pCopyAddFast0(p1, p2, p3)  _pCopyAddFast0(p1, p2, p3)
 
 poly      pmInit(char *s, BOOLEAN &ok);   /* monom -> poly */
@@ -209,6 +210,7 @@
 #define pEqual(p1, p2) _pEqual(p1, p2)
 
-// returns TRUE, if leading monom of a is dividble be leading monom of b
-#if defined(macintosh) || defined(DIV_COUNT)
+// returns TRUE, if leading monom of a divides leading monom of b
+// i.e., if there exists a expvector c > 0, s.t. b = a + c
+#if defined(macintosh) 
 BOOLEAN   pDivisibleBy(poly a, poly b);
 #else
@@ -217,6 +219,5 @@
 // like pDivisibleBy, except that it is assumed that a!=NULL
 #define pDivisibleBy1(a,b)   _pDivisibleBy1(a,b)
-// returns TRUE, if leading monom of a is dividble be leading monom of b
-// assumes a != NULL, b != NULL, and does not check components
+// like pDivisibleBy, assumes a != NULL, does not check components
 #define pDivisibleBy2(a, b) _pDivisibleBy2(a,b)
 
Index: Singular/ring.cc
===================================================================
--- Singular/ring.cc	(revision e0fb8d31ff69374db7f865baedfda3e614804382)
+++ Singular/ring.cc	(revision c5f63ab4be0601efd72bd46f087caac45b03f393)
@@ -2,5 +2,5 @@
 *  Computer Algebra System SINGULAR     *
 ****************************************/
-/* $Id: ring.cc,v 1.16 1998-03-16 14:56:40 obachman Exp $ */
+/* $Id: ring.cc,v 1.17 1998-03-18 14:28:52 obachman Exp $ */
 
 /*
@@ -665,13 +665,11 @@
 #ifdef COMP_FAST
 // set those fields of the ring, which can be computed from other fields:
-// More particularly, set:
-// r->VarOffset, r->CompIndex
+// More particularly, sets r->VarOffset 
 
 void rComplete(ring r)
 {
-  int dummy, VarOffset, CompIndex;
-  pGetVarIndicies(r, VarOffset, CompIndex, dummy, dummy);
+  int dummy, VarOffset;
+  pGetVarIndicies(r, VarOffset, dummy, dummy);
   r->VarOffset = (short) VarOffset;
-  r->CompIndex = (short) CompIndex;
 }
 #endif
Index: Singular/spolys.cc
===================================================================
--- Singular/spolys.cc	(revision e0fb8d31ff69374db7f865baedfda3e614804382)
+++ Singular/spolys.cc	(revision c5f63ab4be0601efd72bd46f087caac45b03f393)
@@ -614,5 +614,5 @@
     pSetm(m1);
     pSetm(m2);
-    cm = t_pComp0(m1, m2);
+    cm = pComp0(m1, m2);
     if (cm!=0)
     {
Index: Singular/spolys0.cc
===================================================================
--- Singular/spolys0.cc	(revision e0fb8d31ff69374db7f865baedfda3e614804382)
+++ Singular/spolys0.cc	(revision c5f63ab4be0601efd72bd46f087caac45b03f393)
@@ -2,5 +2,5 @@
 *  Computer Algebra System SINGULAR     *
 ****************************************/
-/* $Id: spolys0.cc,v 1.9 1998-03-16 14:56:46 obachman Exp $ */
+/* $Id: spolys0.cc,v 1.10 1998-03-18 14:28:54 obachman Exp $ */
 
 /*
@@ -797,5 +797,5 @@
     pSetm(m1);
     pSetm(m2);
-    cm = t_pComp0(m1, m2);
+    cm = pComp0(m1, m2);
     if (cm!=0)
     {
