? kaboodle
? libtommath/bn_mp_bz_div.c
? unix/autom4te.cache
Index: generic/tclTomMath.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTomMath.decls,v
retrieving revision 1.5
diff -b -u -r1.5 tclTomMath.decls
--- generic/tclTomMath.decls	22 Oct 2008 20:23:59 -0000	1.5
+++ generic/tclTomMath.decls	29 Jun 2009 23:10:45 -0000
@@ -213,3 +213,6 @@
 declare 60 generic {
     int TclBN_s_mp_sub(mp_int* a, mp_int* b, mp_int* c)
 }
+declare 61 generic {
+    int TclBN_mp_bz_div(mp_int* a, mp_int* b, mp_int* c, mp_int* d)
+}
\ No newline at end of file
Index: generic/tclTomMath.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTomMath.h,v
retrieving revision 1.10
diff -b -u -r1.10 tclTomMath.h
--- generic/tclTomMath.h	14 Feb 2007 17:59:21 -0000	1.10
+++ generic/tclTomMath.h	29 Jun 2009 23:10:45 -0000
@@ -175,7 +175,8 @@
 
 /* you'll have to tune these... */
 #if defined(BUILD_tcl) || !defined(_WIN32)
-MODULE_SCOPE int KARATSUBA_MUL_CUTOFF,
+MODULE_SCOPE int BZ_DIV_CUTOFF,
+	   KARATSUBA_MUL_CUTOFF,
            KARATSUBA_SQR_CUTOFF,
            TOOM_MUL_CUTOFF,
            TOOM_SQR_CUTOFF;
@@ -826,6 +827,9 @@
 /*
 void bn_reverse(unsigned char *s, int len);
 */
+/*
+int mp_bz_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r);
+*/
 
 #if defined(BUILD_tcl) || !defined(_WIN32)
 MODULE_SCOPE const char *mp_s_rmap;
@@ -838,8 +842,8 @@
 #endif
 
 
-/* $Source: /cvsroot/tcl/tcl/generic/tclTomMath.h,v $ */
+/* $Source: /cvsroot/tcl/libtommath/tommath.h,v $ */
 /* Based on Tom's version 1.8 */
-/* $Revision: 1.10 $ */
-/* $Date: 2007/02/14 17:59:21 $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/12/01 00:31:32 $ */
 
Index: generic/tclTomMathDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTomMathDecls.h,v
retrieving revision 1.9
diff -b -u -r1.9 tclTomMathDecls.h
--- generic/tclTomMathDecls.h	22 Oct 2008 20:23:59 -0000	1.9
+++ generic/tclTomMathDecls.h	29 Jun 2009 23:10:45 -0000
@@ -59,6 +59,7 @@
 #define mp_add TclBN_mp_add
 #define mp_add_d TclBN_mp_add_d
 #define mp_and TclBN_mp_and
+#define mp_bz_div TclBN_mp_bz_div
 #define mp_clamp TclBN_mp_clamp
 #define mp_clear TclBN_mp_clear
 #define mp_clear_multi TclBN_mp_clear_multi
@@ -452,6 +453,12 @@
 /* 60 */
 EXTERN int		TclBN_s_mp_sub (mp_int* a, mp_int* b, mp_int* c);
 #endif
+#ifndef TclBN_mp_bz_div_TCL_DECLARED
+#define TclBN_mp_bz_div_TCL_DECLARED
+/* 61 */
+EXTERN int		TclBN_mp_bz_div (mp_int* a, mp_int* b, mp_int* c,
+				mp_int* d);
+#endif
 
 typedef struct TclTomMathStubs {
     int magic;
@@ -518,6 +525,7 @@
     int (*tclBN_s_mp_mul_digs) (mp_int* a, mp_int* b, mp_int* c, int digs); /* 58 */
     int (*tclBN_s_mp_sqr) (mp_int* a, mp_int* b); /* 59 */
     int (*tclBN_s_mp_sub) (mp_int* a, mp_int* b, mp_int* c); /* 60 */
+    int (*tclBN_mp_bz_div) (mp_int* a, mp_int* b, mp_int* c, mp_int* d); /* 61 */
 } TclTomMathStubs;
 
 #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
@@ -774,6 +782,10 @@
 #define TclBN_s_mp_sub \
 	(tclTomMathStubsPtr->tclBN_s_mp_sub) /* 60 */
 #endif
+#ifndef TclBN_mp_bz_div
+#define TclBN_mp_bz_div \
+	(tclTomMathStubsPtr->tclBN_mp_bz_div) /* 61 */
+#endif
 
 #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
 
Index: libtommath/bn_mp_div.c
===================================================================
RCS file: /cvsroot/tcl/libtommath/bn_mp_div.c,v
retrieving revision 1.4
diff -b -u -r1.4 bn_mp_div.c
--- libtommath/bn_mp_div.c	1 Dec 2006 19:45:38 -0000	1.4
+++ libtommath/bn_mp_div.c	29 Jun 2009 23:10:45 -0000
@@ -123,6 +123,12 @@
     return res;
   }
 
+#if defined(BN_MP_BZ_DIV_C)
+  if (b->used > BZ_DIV_CUTOFF) {
+      return mp_bz_div(a, b, c, d);
+  }
+#endif
+
   if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) {
     return res;
   }
Index: libtommath/bncore.c
===================================================================
RCS file: /cvsroot/tcl/libtommath/bncore.c,v
retrieving revision 1.3
diff -b -u -r1.3 bncore.c
--- libtommath/bncore.c	1 Dec 2006 19:45:38 -0000	1.3
+++ libtommath/bncore.c	29 Jun 2009 23:10:45 -0000
@@ -24,7 +24,9 @@
  
 */
 
-int     KARATSUBA_MUL_CUTOFF = 80,      /* Min. number of digits before Karatsuba multiplication is used. */
+int     BZ_DIV_CUTOFF	     = 10000000,
+					/* Min. number of digits before Burnikel-Ziegler division is used. */
+        KARATSUBA_MUL_CUTOFF = 80,      /* Min. number of digits before Karatsuba multiplication is used. */
         KARATSUBA_SQR_CUTOFF = 120,     /* Min. number of digits before Karatsuba squaring is used. */
         
         TOOM_MUL_CUTOFF      = 350,      /* no optimal values of these are known yet so set em high */
Index: libtommath/tommath.h
===================================================================
RCS file: /cvsroot/tcl/libtommath/tommath.h,v
retrieving revision 1.4
diff -b -u -r1.4 tommath.h
--- libtommath/tommath.h	1 Dec 2006 00:31:32 -0000	1.4
+++ libtommath/tommath.h	29 Jun 2009 23:10:45 -0000
@@ -155,7 +155,8 @@
 typedef int           mp_err;
 
 /* you'll have to tune these... */
-extern int KARATSUBA_MUL_CUTOFF,
+extern int BZ_DIV_CUTOFF,
+	   KARATSUBA_MUL_CUTOFF,
            KARATSUBA_SQR_CUTOFF,
            TOOM_MUL_CUTOFF,
            TOOM_SQR_CUTOFF;
@@ -569,6 +570,7 @@
 int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int mode);
 int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int mode);
 void bn_reverse(unsigned char *s, int len);
+int mp_bz_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r);
 
 extern const char *mp_s_rmap;
 
Index: libtommath/tommath_class.h
===================================================================
RCS file: /cvsroot/tcl/libtommath/tommath_class.h,v
retrieving revision 1.3
diff -b -u -r1.3 tommath_class.h
--- libtommath/tommath_class.h	1 Dec 2006 19:45:39 -0000	1.3
+++ libtommath/tommath_class.h	29 Jun 2009 23:10:45 -0000
@@ -20,6 +20,7 @@
 #define BN_MP_ADD_D_C
 #define BN_MP_ADDMOD_C
 #define BN_MP_AND_C
+#define BN_MP_BZ_DIV_C
 #define BN_MP_CLAMP_C
 #define BN_MP_CLEAR_C
 #define BN_MP_CLEAR_MULTI_C
@@ -208,6 +209,16 @@
    #define BN_MP_CLEAR_C
 #endif
 
+#if defined(BN_MP_BZ_DIV_C)
+    #define BN_MP_CLAMP_C
+    #define BN_MP_CLEAR_C
+    #define BN_MP_DIV_2D_C
+    #define BN_MP_GROW_C
+    #define BN_MP_INIT_C
+    #define BN_MP_INIT_SIZE_C
+    #define BN_MP_MUL_2D_C
+#endif
+
 #if defined(BN_MP_CLAMP_C)
 #endif
 
Index: unix/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/Makefile.in,v
retrieving revision 1.271
diff -b -u -r1.271 Makefile.in
--- unix/Makefile.in	26 Jun 2009 18:14:25 -0000	1.271
+++ unix/Makefile.in	29 Jun 2009 23:10:45 -0000
@@ -310,7 +310,8 @@
 
 TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \
 	bn_fast_s_mp_sqr.o bn_mp_add.o bn_mp_and.o \
-        bn_mp_add_d.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o \
+        bn_mp_add_d.o bn_mp_bz_div.o \
+	bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o \
         bn_mp_cmp.o bn_mp_cmp_d.o bn_mp_cmp_mag.o bn_mp_copy.o \
 	bn_mp_count_bits.o bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o \
 	bn_mp_div_2d.o bn_mp_div_3.o \
@@ -466,6 +467,7 @@
 	$(TOMMATH_DIR)/bn_mp_add.c \
 	$(TOMMATH_DIR)/bn_mp_add_d.c \
 	$(TOMMATH_DIR)/bn_mp_and.c \
+	$(TOMMATH_DIR)/bn_mp_bz_div.c \
 	$(TOMMATH_DIR)/bn_mp_clamp.c \
 	$(TOMMATH_DIR)/bn_mp_clear.c \
 	$(TOMMATH_DIR)/bn_mp_clear_multi.c \
@@ -1302,6 +1304,9 @@
 bn_mp_and.o: $(TOMMATH_DIR)/bn_mp_and.c $(MATHHDRS)
 	$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_and.c
 
+bn_mp_bz_div.o: $(TOMMATH_DIR)/bn_mp_bz_div.c $(MATHHDRS)
+	$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_bz_div.c
+
 bn_mp_clamp.o: $(TOMMATH_DIR)/bn_mp_clamp.c $(MATHHDRS)
 	$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_clamp.c
 
Index: win/Makefile.in
===================================================================
RCS file: /cvsroot/tcl/tcl/win/Makefile.in,v
retrieving revision 1.156
diff -b -u -r1.156 Makefile.in
--- win/Makefile.in	29 May 2009 16:28:40 -0000	1.156
+++ win/Makefile.in	29 Jun 2009 23:10:45 -0000
@@ -303,6 +303,7 @@
 	bn_mp_add.${OBJEXT} \
 	bn_mp_add_d.${OBJEXT} \
 	bn_mp_and.${OBJEXT} \
+	bn_mp_bz_div.$(OBJEXT) \
 	bn_mp_clamp.${OBJEXT} \
 	bn_mp_clear.${OBJEXT} \
 	bn_mp_clear_multi.${OBJEXT} \
Index: win/makefile.vc
===================================================================
RCS file: /cvsroot/tcl/tcl/win/makefile.vc,v
retrieving revision 1.199
diff -b -u -r1.199 makefile.vc
--- win/makefile.vc	10 Apr 2009 14:19:45 -0000	1.199
+++ win/makefile.vc	29 Jun 2009 23:10:46 -0000
@@ -350,6 +350,7 @@
 	$(TMP_DIR)\bn_mp_add.obj \
 	$(TMP_DIR)\bn_mp_add_d.obj \
 	$(TMP_DIR)\bn_mp_and.obj \
+	$(TMP_DIR)\bn_mp_bz_div.obj \
 	$(TMP_DIR)\bn_mp_clamp.obj \
 	$(TMP_DIR)\bn_mp_clear.obj \
 	$(TMP_DIR)\bn_mp_clear_multi.obj \
