/* -*-c-*-
*
- * $Id: mpx.h,v 1.13 2002/10/06 22:52:50 mdw Exp $
+ * $Id: mpx.h,v 1.14 2002/10/09 00:36:03 mdw Exp $
*
* Low level multiprecision arithmetic
*
/*----- Revision history --------------------------------------------------*
*
* $Log: mpx.h,v $
+ * Revision 1.14 2002/10/09 00:36:03 mdw
+ * Fix bounds on workspace for Karatsuba operations.
+ *
* Revision 1.13 2002/10/06 22:52:50 mdw
* Pile of changes for supporting two's complement properly.
*
*
* This is the limiting length for using Karatsuba algorithms. It's best to
* use the simpler classical multiplication method on numbers smaller than
- * this.
+ * this. It is unsafe to make this constant less than four (i.e., the
+ * algorithms will fail).
*/
#define MPK_THRESH 16
-/* --- @MPK_SLOP@ --- *
- *
- * The extra number of words required as scratch space by the Karatsuba
- * routines. This is a (generous) guess, since the actual amount of space
- * required is proportional to the recursion depth.
- */
-
-#define MPK_SLOP 64
-
/* --- @mpx_kmul@ --- *
*
* Arguments: @mpw *dv, *dvl@ = pointer to destination buffer
* multiplication (e.g., @mpx_umul@) on large numbers, although
* more expensive on small ones.
*
- * The destination and scratch buffers must be twice as large as
- * the larger argument. The scratch space must be twice as
- * large as the larger argument, plus the magic number
- * @MPK_SLOP@.
+ * The destination must be three times as large as the larger
+ * argument. The scratch space must be five times as large as
+ * the larger argument.
*/
extern void mpx_kmul(mpw */*dv*/, mpw */*dvl*/,
* large numbers, although more expensive on small ones, and
* rather simpler than full-blown Karatsuba multiplication.
*
- * The destination must be twice as large as the argument. The
- * scratch space must be twice as large as the argument, plus
- * the magic number @MPK_SLOP@.
+ * The destination must be three times as large as the larger
+ * argument. The scratch space must be five times as large as
+ * the larger argument.
*/
extern void mpx_ksqr(mpw */*dv*/, mpw */*dvl*/,