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 | 8f339500a2b79c84698261987f664ed30af94814 (patch) | |
tree | dfc95748319b9285f975bf6225313dfb5686f16c /libtommath/bn_mp_sub_d.c | |
parent | bf01a303da2833ef352dae626b2a8d4929aaca37 (diff) | |
download | tcl-8f339500a2b79c84698261987f664ed30af94814.zip tcl-8f339500a2b79c84698261987f664ed30af94814.tar.gz tcl-8f339500a2b79c84698261987f664ed30af94814.tar.bz2 |
'const'ify more libtommath functions. All functions in generic/tclTomMath.decls (used by Tcl) are done now.
Diffstat (limited to 'libtommath/bn_mp_sub_d.c')
-rw-r--r-- | libtommath/bn_mp_sub_d.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 5e96030..2d24899 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -17,7 +17,7 @@ /* single digit subtraction */ int -mp_sub_d (mp_int * a, mp_digit b, mp_int * c) +mp_sub_d (const mp_int * a, mp_digit b, mp_int * c) { mp_digit *tmpa, *tmpc, mu; int res, ix, oldused; @@ -33,9 +33,10 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) * addition [with fudged signs] */ if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; + mp_int a_ = *a; + a_.sign = MP_ZPOS; + res = mp_add_d(&a_, b, c); + c->sign = MP_NEG; /* clamp */ mp_clamp(c); |