diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-09-15 13:08:31 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-09-15 13:08:31 (GMT) |
commit | 0faaca01de4e9fa2039c7fdd34f60b138f665249 (patch) | |
tree | dfc95748319b9285f975bf6225313dfb5686f16c /generic/tclTomMathDecls.h | |
parent | 130ba65bbe11f114680bbd9f9d45ec3b5de0caef (diff) | |
download | tcl-0faaca01de4e9fa2039c7fdd34f60b138f665249.zip tcl-0faaca01de4e9fa2039c7fdd34f60b138f665249.tar.gz tcl-0faaca01de4e9fa2039c7fdd34f60b138f665249.tar.bz2 |
'const'ify more libtommath functions. All functions in generic/tclTomMath.decls (used by Tcl) are done now.
Diffstat (limited to 'generic/tclTomMathDecls.h')
-rw-r--r-- | generic/tclTomMathDecls.h | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 03f383f..f3145d7 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -156,7 +156,8 @@ EXTERN int TclBN_revision(void); EXTERN int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c); /* 3 */ -EXTERN int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_add_d(const mp_int *a, mp_digit b, + mp_int *c); /* 4 */ EXTERN int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c); @@ -249,17 +250,19 @@ EXTERN int TclBN_mp_sqrt(const mp_int *a, mp_int *b); EXTERN int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c); /* 43 */ -EXTERN int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_sub_d(const mp_int *a, mp_digit b, + mp_int *c); /* 44 */ -EXTERN int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b); +EXTERN int TclBN_mp_to_unsigned_bin(const mp_int *a, + unsigned char *b); /* 45 */ -EXTERN int TclBN_mp_to_unsigned_bin_n(mp_int *a, +EXTERN int TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen); /* 46 */ -EXTERN int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, - int maxlen); +EXTERN int TclBN_mp_toradix_n(const mp_int *a, char *str, + int radix, int maxlen); /* 47 */ -EXTERN int TclBN_mp_unsigned_bin_size(mp_int *a); +EXTERN int TclBN_mp_unsigned_bin_size(const mp_int *a); /* 48 */ EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c); @@ -300,7 +303,7 @@ EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i); /* 63 */ EXTERN int TclBN_mp_cnt_lsb(const mp_int *a); /* 64 */ -TCL_DEPRECATED("Use mp_init() + mp_set_long() or mp_set_long_long()") +TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") void TclBNInitBignumFromLong(mp_int *bignum, long initVal); /* 65 */ TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") @@ -317,6 +320,10 @@ EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); /* 69 */ EXTERN Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a); +/* 70 */ +EXTERN int TclBN_mp_set_long(mp_int *a, unsigned long i); +/* 71 */ +EXTERN unsigned long TclBN_mp_get_long(const mp_int *a); typedef struct TclTomMathStubs { int magic; @@ -325,7 +332,7 @@ typedef struct TclTomMathStubs { int (*tclBN_epoch) (void); /* 0 */ int (*tclBN_revision) (void); /* 1 */ int (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */ - int (*tclBN_mp_add_d) (mp_int *a, mp_digit b, mp_int *c); /* 3 */ + int (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */ int (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */ void (*tclBN_mp_clamp) (mp_int *a); /* 5 */ void (*tclBN_mp_clear) (mp_int *a); /* 6 */ @@ -365,11 +372,11 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */ int (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */ int (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */ - int (*tclBN_mp_sub_d) (mp_int *a, mp_digit b, mp_int *c); /* 43 */ - int (*tclBN_mp_to_unsigned_bin) (mp_int *a, unsigned char *b); /* 44 */ - int (*tclBN_mp_to_unsigned_bin_n) (mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ - int (*tclBN_mp_toradix_n) (mp_int *a, char *str, int radix, int maxlen); /* 46 */ - int (*tclBN_mp_unsigned_bin_size) (mp_int *a); /* 47 */ + int (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */ + int (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */ + int (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ + int (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */ + int (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */ int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */ void (*tclBN_mp_zero) (mp_int *a); /* 49 */ void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */ @@ -386,12 +393,14 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */ int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */ int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */ - TCL_DEPRECATED_API("Use mp_init() + mp_set_long() or mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ + int (*tclBN_mp_set_long) (mp_int *a, unsigned long i); /* 70 */ + unsigned long (*tclBN_mp_get_long) (const mp_int *a); /* 71 */ } TclTomMathStubs; extern const TclTomMathStubs *tclTomMathStubsPtr; @@ -546,6 +555,10 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBN_mp_set_long_long) /* 68 */ #define TclBN_mp_get_long_long \ (tclTomMathStubsPtr->tclBN_mp_get_long_long) /* 69 */ +#define TclBN_mp_set_long \ + (tclTomMathStubsPtr->tclBN_mp_set_long) /* 70 */ +#define TclBN_mp_get_long \ + (tclTomMathStubsPtr->tclBN_mp_get_long) /* 71 */ #endif /* defined(USE_TCL_STUBS) */ |