diff options
author | nijtmans <nijtmans> | 2010-05-03 14:36:40 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-05-03 14:36:40 (GMT) |
commit | 603632160ce039289adcabac2684febc649c535b (patch) | |
tree | e5adab677558dc22434d9ee6b375a48333aea345 | |
parent | 091c9fee62375b69529473b975e37dc279f0bc83 (diff) | |
download | tcl-603632160ce039289adcabac2684febc649c535b.zip tcl-603632160ce039289adcabac2684febc649c535b.tar.gz tcl-603632160ce039289adcabac2684febc649c535b.tar.bz2 |
CONSTify various useful internal functions
(TclBignumToDouble, TclCeil, TclFloor), and
related tommath functions.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | generic/tclBasic.c | 5 | ||||
-rw-r--r-- | generic/tclInt.h | 8 | ||||
-rwxr-xr-x | generic/tclStrToD.c | 12 | ||||
-rw-r--r-- | generic/tclTomMath.decls | 20 | ||||
-rw-r--r-- | generic/tclTomMath.h | 22 | ||||
-rw-r--r-- | generic/tclTomMathDecls.h | 38 | ||||
-rw-r--r-- | libtommath/bn_mp_cmp.c | 6 | ||||
-rw-r--r-- | libtommath/bn_mp_cmp_d.c | 6 | ||||
-rw-r--r-- | libtommath/bn_mp_cmp_mag.c | 6 | ||||
-rw-r--r-- | libtommath/bn_mp_copy.c | 6 | ||||
-rw-r--r-- | libtommath/bn_mp_count_bits.c | 6 | ||||
-rw-r--r-- | libtommath/bn_mp_div_2d.c | 6 | ||||
-rw-r--r-- | libtommath/bn_mp_mod_2d.c | 6 | ||||
-rw-r--r-- | libtommath/bn_mp_mul_2d.c | 6 | ||||
-rw-r--r-- | libtommath/bn_mp_neg.c | 6 | ||||
-rw-r--r-- | libtommath/tommath.h | 22 |
17 files changed, 107 insertions, 91 deletions
@@ -8,6 +8,23 @@ * win/tclAppInit.c For MINGW/CYGWIN, use GetCommandLineA explicitely * unix/.cvsignore Add pkg, *.dll + * libtommath/tommath.h CONSTify various useful internal functions + * libtommath/bn_mp_cmp_d.c (TclBignumToDouble, TclCeil, TclFloor), and + * libtommath/bn_mp_cmp_mag.c related tommath functions. + * libtommath/bn_mp_cmp.c + * libtommath/bn_mp_copy.c + * libtommath/bn_mp_count_bits.c + * libtommath/bn_mp_div_2d.c + * libtommath/bn_mp_mod_2d.c + * libtommath/bn_mp_mul_2d.c + * libtommath/bn_mp_neg.c + * generic/tclBasic.c Handle TODO: const correctness ? + * generic/tclInt.h + * generic/tclStrToD.c + * generic/tclTomMath.decls + * generic/tclTomMath.h + * generic/tclTomMathDecls.h + 2010-04-30 Don Porter <dgp@users.sourceforge.net> * generic/tcl.h: Bump patchlevel to 8.6b1.2 to distinguish diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 7ded8f7..a7dce89 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.455 2010/04/30 12:38:46 dkf Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.456 2010/05/03 14:36:41 nijtmans Exp $ */ #include "tclInt.h" @@ -7501,8 +7501,7 @@ ExprAbsFunc( #endif if (type == TCL_NUMBER_BIG) { - /* TODO: const correctness ? */ - if (mp_cmp_d((mp_int *) ptr, 0) == MP_LT) { + if (mp_cmp_d((const mp_int *) ptr, 0) == MP_LT) { Tcl_GetBignumFromObj(NULL, objv[1], &big); tooLarge: mp_neg(&big, &big); diff --git a/generic/tclInt.h b/generic/tclInt.h index 5e37a56..fa503cc 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.475 2010/04/30 20:52:51 dgp Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.476 2010/05/03 14:36:40 nijtmans Exp $ */ #ifndef _TCLINT @@ -2823,11 +2823,11 @@ MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj, CmdFrame **cfPtrPtr, int *wordPtr); MODULE_SCOPE int TclArraySet(Tcl_Interp *interp, Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj); -MODULE_SCOPE double TclBignumToDouble(mp_int *bignum); +MODULE_SCOPE double TclBignumToDouble(const mp_int *bignum); MODULE_SCOPE int TclByteArrayMatch(const unsigned char *string, int strLen, const unsigned char *pattern, int ptnLen, int flags); -MODULE_SCOPE double TclCeil(mp_int *a); +MODULE_SCOPE double TclCeil(const mp_int *a); MODULE_SCOPE int TclCheckBadOctal(Tcl_Interp *interp, const char *value); MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp, @@ -2883,7 +2883,7 @@ MODULE_SCOPE void TclFinalizeSynchronization(void); MODULE_SCOPE void TclFinalizeThreadAlloc(void); MODULE_SCOPE void TclFinalizeThreadData(void); MODULE_SCOPE void TclFinalizeThreadObjects(void); -MODULE_SCOPE double TclFloor(mp_int *a); +MODULE_SCOPE double TclFloor(const mp_int *a); MODULE_SCOPE void TclFormatNaN(double value, char *buffer); MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr, const char *attributeName, int *indexPtr); diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index fdfdb5e..8094e87 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.43 2010/04/27 12:36:22 nijtmans Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.44 2010/05/03 14:36:41 nijtmans Exp $ * *---------------------------------------------------------------------- */ @@ -137,7 +137,7 @@ static int n770_fp; /* Flag is 1 on Nokia N770 floating point. static double AbsoluteValue(double v, int *signum); static int AccumulateDecimalDigit(unsigned, int, Tcl_WideUInt *, mp_int *, int); -static double BignumToBiasedFrExp(mp_int *big, int *machexp); +static double BignumToBiasedFrExp(const mp_int *big, int *machexp); static int GetIntegerTimesPower(double v, mp_int *r, int *e); static double MakeHighPrecisionDouble(int signum, mp_int *significand, int nSigDigs, int exponent); @@ -2369,7 +2369,7 @@ Tcl_InitBignumFromDouble( double TclBignumToDouble( - mp_int *a) /* Integer to convert. */ + const mp_int *a) /* Integer to convert. */ { mp_int b; int bits, shift, i; @@ -2430,7 +2430,7 @@ TclBignumToDouble( double TclCeil( - mp_int *a) /* Integer to convert. */ + const mp_int *a) /* Integer to convert. */ { double r = 0.0; mp_int b; @@ -2473,7 +2473,7 @@ TclCeil( double TclFloor( - mp_int *a) /* Integer to convert. */ + const mp_int *a) /* Integer to convert. */ { double r = 0.0; mp_int b; @@ -2529,7 +2529,7 @@ TclFloor( static double BignumToBiasedFrExp( - mp_int *a, /* Integer to convert */ + const mp_int *a, /* Integer to convert */ int *machexp) /* Power of two */ { mp_int b; diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index a170de8..2721c1d 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tclTomMath.decls,v 1.6 2010/01/29 16:17:20 nijtmans Exp $ +# RCS: @(#) $Id: tclTomMath.decls,v 1.7 2010/05/03 14:36:40 nijtmans Exp $ library tcl @@ -50,19 +50,19 @@ declare 7 generic { void TclBN_mp_clear_multi(mp_int *a, ...) } declare 8 generic { - int TclBN_mp_cmp(mp_int *a, mp_int *b) + int TclBN_mp_cmp(const mp_int *a, const mp_int *b) } declare 9 generic { - int TclBN_mp_cmp_d(mp_int *a, mp_digit b) + int TclBN_mp_cmp_d(const mp_int *a, mp_digit b) } declare 10 generic { - int TclBN_mp_cmp_mag(mp_int *a, mp_int *b) + int TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b) } declare 11 generic { - int TclBN_mp_copy(mp_int *a, mp_int *b) + int TclBN_mp_copy(const mp_int *a, mp_int *b) } declare 12 generic { - int TclBN_mp_count_bits(mp_int *a) + int TclBN_mp_count_bits(const mp_int *a) } declare 13 generic { int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r) @@ -74,7 +74,7 @@ declare 15 generic { int TclBN_mp_div_2(mp_int *a, mp_int *q) } declare 16 generic { - int TclBN_mp_div_2d(mp_int *a, int b, mp_int *q, mp_int *r) + int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) } declare 17 generic { int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r) @@ -110,7 +110,7 @@ declare 27 generic { int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r) } declare 28 generic { - int TclBN_mp_mod_2d(mp_int *a, int b, mp_int *r) + int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r) } declare 29 generic { int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p) @@ -122,10 +122,10 @@ declare 31 generic { int TclBN_mp_mul_2(mp_int *a, mp_int *p) } declare 32 generic { - int TclBN_mp_mul_2d(mp_int *a, int d, mp_int *p) + int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p) } declare 33 generic { - int TclBN_mp_neg(mp_int *a, mp_int *b) + int TclBN_mp_neg(const mp_int *a, mp_int *b) } declare 34 generic { int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 73fd7aa..0b2df47 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -290,7 +290,7 @@ int mp_init_set_int (mp_int * a, unsigned long b); /* copy, b = a */ /* -int mp_copy(mp_int *a, mp_int *b); +int mp_copy(const mp_int *a, mp_int *b); */ /* inits and copies, a = b */ @@ -317,7 +317,7 @@ int mp_lshd(mp_int *a, int b); /* c = a / 2**b */ /* -int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d); +int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); */ /* b = a/2 */ @@ -327,7 +327,7 @@ int mp_div_2(mp_int *a, mp_int *b); /* c = a * 2**b */ /* -int mp_mul_2d(mp_int *a, int b, mp_int *c); +int mp_mul_2d(const mp_int *a, int b, mp_int *c); */ /* b = a*2 */ @@ -337,7 +337,7 @@ int mp_mul_2(mp_int *a, mp_int *b); /* c = a mod 2**d */ /* -int mp_mod_2d(mp_int *a, int b, mp_int *c); +int mp_mod_2d(const mp_int *a, int b, mp_int *c); */ /* computes a = 2**b */ @@ -377,7 +377,7 @@ int mp_and(mp_int *a, mp_int *b, mp_int *c); /* b = -a */ /* -int mp_neg(mp_int *a, mp_int *b); +int mp_neg(const mp_int *a, mp_int *b); */ /* b = |a| */ @@ -387,12 +387,12 @@ int mp_abs(mp_int *a, mp_int *b); /* compare a to b */ /* -int mp_cmp(mp_int *a, mp_int *b); +int mp_cmp(const mp_int *a, const mp_int *b); */ /* compare |a| to |b| */ /* -int mp_cmp_mag(mp_int *a, mp_int *b); +int mp_cmp_mag(const mp_int *a, const mp_int *b); */ /* c = a + b */ @@ -429,7 +429,7 @@ int mp_mod(mp_int *a, mp_int *b, mp_int *c); /* compare against a single digit */ /* -int mp_cmp_d(mp_int *a, mp_digit b); +int mp_cmp_d(const mp_int *a, mp_digit b); */ /* c = a + b */ @@ -704,7 +704,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback /* ---> radix conversion <--- */ /* -int mp_count_bits(mp_int *a); +int mp_count_bits(const mp_int *a); */ /* @@ -835,6 +835,6 @@ MODULE_SCOPE const char *mp_s_rmap; /* $Source: /root/tcl/repos-to-convert/tcl/generic/tclTomMath.h,v $ */ /* Based on Tom's version 1.8 */ -/* $Revision: 1.13 $ */ -/* $Date: 2010/05/03 11:38:18 $ */ +/* $Revision: 1.14 $ */ +/* $Date: 2010/05/03 14:36:41 $ */ diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index ee57f96..11555e8 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTomMathDecls.h,v 1.11 2010/02/05 10:03:23 nijtmans Exp $ + * RCS: @(#) $Id: tclTomMathDecls.h,v 1.12 2010/05/03 14:36:41 nijtmans Exp $ */ #ifndef _TCLTOMMATHDECLS @@ -180,27 +180,27 @@ EXTERN void TclBN_mp_clear_multi(mp_int *a, ...); #ifndef TclBN_mp_cmp_TCL_DECLARED #define TclBN_mp_cmp_TCL_DECLARED /* 8 */ -EXTERN int TclBN_mp_cmp(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_cmp(const mp_int *a, const mp_int *b); #endif #ifndef TclBN_mp_cmp_d_TCL_DECLARED #define TclBN_mp_cmp_d_TCL_DECLARED /* 9 */ -EXTERN int TclBN_mp_cmp_d(mp_int *a, mp_digit b); +EXTERN int TclBN_mp_cmp_d(const mp_int *a, mp_digit b); #endif #ifndef TclBN_mp_cmp_mag_TCL_DECLARED #define TclBN_mp_cmp_mag_TCL_DECLARED /* 10 */ -EXTERN int TclBN_mp_cmp_mag(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_cmp_mag(const mp_int *a, const mp_int *b); #endif #ifndef TclBN_mp_copy_TCL_DECLARED #define TclBN_mp_copy_TCL_DECLARED /* 11 */ -EXTERN int TclBN_mp_copy(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_copy(const mp_int *a, mp_int *b); #endif #ifndef TclBN_mp_count_bits_TCL_DECLARED #define TclBN_mp_count_bits_TCL_DECLARED /* 12 */ -EXTERN int TclBN_mp_count_bits(mp_int *a); +EXTERN int TclBN_mp_count_bits(const mp_int *a); #endif #ifndef TclBN_mp_div_TCL_DECLARED #define TclBN_mp_div_TCL_DECLARED @@ -222,7 +222,7 @@ EXTERN int TclBN_mp_div_2(mp_int *a, mp_int *q); #ifndef TclBN_mp_div_2d_TCL_DECLARED #define TclBN_mp_div_2d_TCL_DECLARED /* 16 */ -EXTERN int TclBN_mp_div_2d(mp_int *a, int b, mp_int *q, +EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r); #endif #ifndef TclBN_mp_div_3_TCL_DECLARED @@ -283,7 +283,7 @@ EXTERN int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r); #ifndef TclBN_mp_mod_2d_TCL_DECLARED #define TclBN_mp_mod_2d_TCL_DECLARED /* 28 */ -EXTERN int TclBN_mp_mod_2d(mp_int *a, int b, mp_int *r); +EXTERN int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r); #endif #ifndef TclBN_mp_mul_TCL_DECLARED #define TclBN_mp_mul_TCL_DECLARED @@ -303,12 +303,12 @@ EXTERN int TclBN_mp_mul_2(mp_int *a, mp_int *p); #ifndef TclBN_mp_mul_2d_TCL_DECLARED #define TclBN_mp_mul_2d_TCL_DECLARED /* 32 */ -EXTERN int TclBN_mp_mul_2d(mp_int *a, int d, mp_int *p); +EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p); #endif #ifndef TclBN_mp_neg_TCL_DECLARED #define TclBN_mp_neg_TCL_DECLARED /* 33 */ -EXTERN int TclBN_mp_neg(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_neg(const mp_int *a, mp_int *b); #endif #ifndef TclBN_mp_or_TCL_DECLARED #define TclBN_mp_or_TCL_DECLARED @@ -464,15 +464,15 @@ typedef struct TclTomMathStubs { void (*tclBN_mp_clamp) (mp_int *a); /* 5 */ void (*tclBN_mp_clear) (mp_int *a); /* 6 */ void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */ - int (*tclBN_mp_cmp) (mp_int *a, mp_int *b); /* 8 */ - int (*tclBN_mp_cmp_d) (mp_int *a, mp_digit b); /* 9 */ - int (*tclBN_mp_cmp_mag) (mp_int *a, mp_int *b); /* 10 */ - int (*tclBN_mp_copy) (mp_int *a, mp_int *b); /* 11 */ - int (*tclBN_mp_count_bits) (mp_int *a); /* 12 */ + int (*tclBN_mp_cmp) (const mp_int *a, const mp_int *b); /* 8 */ + int (*tclBN_mp_cmp_d) (const mp_int *a, mp_digit b); /* 9 */ + int (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */ + int (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */ + int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */ int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */ int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ int (*tclBN_mp_div_2) (mp_int *a, mp_int *q); /* 15 */ - int (*tclBN_mp_div_2d) (mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */ + int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */ int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */ void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */ int (*tclBN_mp_expt_d) (mp_int *a, mp_digit b, mp_int *c); /* 19 */ @@ -484,12 +484,12 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */ int (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */ int (*tclBN_mp_mod) (mp_int *a, mp_int *b, mp_int *r); /* 27 */ - int (*tclBN_mp_mod_2d) (mp_int *a, int b, mp_int *r); /* 28 */ + int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */ int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */ int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */ int (*tclBN_mp_mul_2) (mp_int *a, mp_int *p); /* 31 */ - int (*tclBN_mp_mul_2d) (mp_int *a, int d, mp_int *p); /* 32 */ - int (*tclBN_mp_neg) (mp_int *a, mp_int *b); /* 33 */ + int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */ + int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */ int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */ int (*tclBN_mp_radix_size) (mp_int *a, int radix, int *size); /* 35 */ int (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */ diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 6361730..8029633 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -17,7 +17,7 @@ /* compare two ints (signed)*/ int -mp_cmp (mp_int * a, mp_int * b) +mp_cmp (const mp_int * a, const mp_int * b) { /* compare based on sign */ if (a->sign != b->sign) { @@ -39,5 +39,5 @@ mp_cmp (mp_int * a, mp_int * b) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_cmp.c,v $ */ -/* $Revision: 1.1.1.3 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index 92c3567..2dded75 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -16,7 +16,7 @@ */ /* compare a digit */ -int mp_cmp_d(mp_int * a, mp_digit b) +int mp_cmp_d(const mp_int * a, mp_digit b) { /* compare based on sign */ if (a->sign == MP_NEG) { @@ -40,5 +40,5 @@ int mp_cmp_d(mp_int * a, mp_digit b) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_cmp_d.c,v $ */ -/* $Revision: 1.1.1.3 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index 31c8221..8c6c169 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -16,7 +16,7 @@ */ /* compare maginitude of two ints (unsigned) */ -int mp_cmp_mag (mp_int * a, mp_int * b) +int mp_cmp_mag (const mp_int * a, const mp_int * b) { int n; mp_digit *tmpa, *tmpb; @@ -51,5 +51,5 @@ int mp_cmp_mag (mp_int * a, mp_int * b) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_cmp_mag.c,v $ */ -/* $Revision: 1.1.1.3 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index a5d5e6f..1d6c5cb 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -17,7 +17,7 @@ /* copy, b = a */ int -mp_copy (mp_int * a, mp_int * b) +mp_copy (const mp_int * a, mp_int * b) { int res, n; @@ -64,5 +64,5 @@ mp_copy (mp_int * a, mp_int * b) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_copy.c,v $ */ -/* $Revision: 1.1.1.3 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index 44c0cff..909c153 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -17,7 +17,7 @@ /* returns the number of bits in an int */ int -mp_count_bits (mp_int * a) +mp_count_bits (const mp_int * a) { int r; mp_digit q; @@ -41,5 +41,5 @@ mp_count_bits (mp_int * a) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_count_bits.c,v $ */ -/* $Revision: 1.1.1.3 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index 12a7c99..2bdbdb5 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -16,7 +16,7 @@ */ /* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) +int mp_div_2d (const mp_int * a, int b, mp_int * c, mp_int * d) { mp_digit D, r, rr; int x, res; @@ -93,5 +93,5 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_div_2d.c,v $ */ -/* $Revision: 1.1.1.3 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 2ab7e33..e94a819 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -17,7 +17,7 @@ /* calc a value mod 2**b */ int -mp_mod_2d (mp_int * a, int b, mp_int * c) +mp_mod_2d (const mp_int * a, int b, mp_int * c) { int x, res; @@ -51,5 +51,5 @@ mp_mod_2d (mp_int * a, int b, mp_int * c) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mod_2d.c,v $ */ -/* $Revision: 1.1.1.3 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index 88fa080..8672ee3 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -16,7 +16,7 @@ */ /* shift left by a certain bit count */ -int mp_mul_2d (mp_int * a, int b, mp_int * c) +int mp_mul_2d (const mp_int * a, int b, mp_int * c) { mp_digit d; int res; @@ -81,5 +81,5 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_mul_2d.c,v $ */ -/* $Revision: 1.1.1.3 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index 17e851a..886db3f 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -16,7 +16,7 @@ */ /* b = -a */ -int mp_neg (mp_int * a, mp_int * b) +int mp_neg (const mp_int * a, mp_int * b) { int res; if (a != b) { @@ -36,5 +36,5 @@ int mp_neg (mp_int * a, mp_int * b) #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_neg.c,v $ */ -/* $Revision: 1.1.1.4 $ */ -/* $Date: 2006/12/01 00:08:11 $ */ +/* $Revision: 1.2 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index f869262..7cc7d4e 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -241,7 +241,7 @@ int mp_init_set (mp_int * a, mp_digit b); int mp_init_set_int (mp_int * a, unsigned long b); /* copy, b = a */ -int mp_copy(mp_int *a, mp_int *b); +int mp_copy(const mp_int *a, mp_int *b); /* inits and copies, a = b */ int mp_init_copy(mp_int *a, mp_int *b); @@ -258,19 +258,19 @@ void mp_rshd(mp_int *a, int b); int mp_lshd(mp_int *a, int b); /* c = a / 2**b */ -int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d); +int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ int mp_div_2(mp_int *a, mp_int *b); /* c = a * 2**b */ -int mp_mul_2d(mp_int *a, int b, mp_int *c); +int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ int mp_mul_2(mp_int *a, mp_int *b); /* c = a mod 2**d */ -int mp_mod_2d(mp_int *a, int b, mp_int *c); +int mp_mod_2d(const mp_int *a, int b, mp_int *c); /* computes a = 2**b */ int mp_2expt(mp_int *a, int b); @@ -296,16 +296,16 @@ int mp_and(mp_int *a, mp_int *b, mp_int *c); /* ---> Basic arithmetic <--- */ /* b = -a */ -int mp_neg(mp_int *a, mp_int *b); +int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ int mp_abs(mp_int *a, mp_int *b); /* compare a to b */ -int mp_cmp(mp_int *a, mp_int *b); +int mp_cmp(const mp_int *a, const mp_int *b); /* compare |a| to |b| */ -int mp_cmp_mag(mp_int *a, mp_int *b); +int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ int mp_add(mp_int *a, mp_int *b, mp_int *c); @@ -328,7 +328,7 @@ int mp_mod(mp_int *a, mp_int *b, mp_int *c); /* ---> single digit functions <--- */ /* compare against a single digit */ -int mp_cmp_d(mp_int *a, mp_digit b); +int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ int mp_add_d(mp_int *a, mp_digit b, mp_int *c); @@ -517,7 +517,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style); int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat); /* ---> radix conversion <--- */ -int mp_count_bits(mp_int *a); +int mp_count_bits(const mp_int *a); int mp_unsigned_bin_size(mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); @@ -581,5 +581,5 @@ extern const char *mp_s_rmap; /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/tommath.h,v $ */ /* Based on Tom's version 1.8 */ -/* $Revision: 1.5 $ */ -/* $Date: 2010/05/03 11:40:12 $ */ +/* $Revision: 1.6 $ */ +/* $Date: 2010/05/03 14:36:40 $ */ |