Fix bounds on workspace for Karatsuba operations.
[u/mdw/catacomb] / gfx-kmul.c
index dc2e524..f5390f4 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: gfx-kmul.c,v 1.1 2000/10/08 15:49:37 mdw Exp $
+ * $Id: gfx-kmul.c,v 1.2 2002/10/09 00:36:03 mdw Exp $
  *
  * Karatsuba's multiplication algorithm on binary polynomials
  *
@@ -30,6 +30,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: gfx-kmul.c,v $
+ * Revision 1.2  2002/10/09 00:36:03  mdw
+ * Fix bounds on workspace for Karatsuba operations.
+ *
  * Revision 1.1  2000/10/08 15:49:37  mdw
  * First glimmerings of binary polynomial arithmetic.
  *
@@ -130,17 +133,14 @@ void gfx_kmul(mpw *dv, mpw *dvl,
       avm = avl;
   }
 
-  assert(((void)"Destination too small for Karatsuba gf-multiply",
-         dvl - dv >= 4 * m));
-  assert(((void)"Not enough workspace for Karatsuba gf-multiply",
-         svl - sv >= 4 * m));
-
   /* --- Sort out the middle term --- */
 
   {
     mpw *bsv = sv + m, *ssv = bsv + m;
     mpw *rdv = dv + m, *rdvl = rdv + 2 * m;
 
+    assert(rdvl < dvl);
+    assert(ssv < svl);
     UXOR2(sv, bsv, av, avm, avm, avl);
     UXOR2(bsv, ssv, bv, bvm, bvm, bvl);
     if (m > GFK_THRESH)