summaryrefslogtreecommitdiffstats
path: root/libtommath/tommath.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-31 11:51:58 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-31 11:51:58 (GMT)
commite80cd8e2841210153d80ec6fe42342d91d74a6d7 (patch)
tree1f42bfb00e83f54bbe824a5560f7916da7a26090 /libtommath/tommath.h
parent4b67509c242f6c46325dc5b85420aa20b1399e77 (diff)
parentbe861c2430ca13fd13b81ff3bcdc6fc0cb4ec8f4 (diff)
downloadtcl-e80cd8e2841210153d80ec6fe42342d91d74a6d7.zip
tcl-e80cd8e2841210153d80ec6fe42342d91d74a6d7.tar.gz
tcl-e80cd8e2841210153d80ec6fe42342d91d74a6d7.tar.bz2
Merge 8.6
Diffstat (limited to 'libtommath/tommath.h')
-rw-r--r--libtommath/tommath.h26
1 files changed, 9 insertions, 17 deletions
diff --git a/libtommath/tommath.h b/libtommath/tommath.h
index b5faf8c..5fd149c 100644
--- a/libtommath/tommath.h
+++ b/libtommath/tommath.h
@@ -1,14 +1,6 @@
-/* LibTomMath, multiple-precision integer library -- Tom St Denis
- *
- * LibTomMath is a library that provides multiple-precision
- * integer arithmetic as well as number theoretic functionality.
- *
- * The library was designed directly after the MPI library by
- * Michael Fromberger but has been written from scratch with
- * additional optimizations in place.
- *
- * SPDX-License-Identifier: Unlicense
- */
+/* LibTomMath, multiple-precision integer library -- Tom St Denis */
+/* SPDX-License-Identifier: Unlicense */
+
#ifndef BN_H_
#define BN_H_
@@ -159,18 +151,18 @@ void mp_clear_multi(mp_int *mp, ...);
void mp_exch(mp_int *a, mp_int *b);
/* shrink ram required for a bignum */
-int mp_shrink(mp_int *a);
+mp_err mp_shrink(mp_int *a);
/* grow an int to a given size */
-int mp_grow(mp_int *a, int size);
+mp_err mp_grow(mp_int *a, int size);
/* init to a given number of digits */
-int mp_init_size(mp_int *a, int size);
+mp_err mp_init_size(mp_int *a, int size);
/* ---> Basic Manipulations <--- */
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
-#define mp_iseven(a) (!mp_get_bit((a),0))
-#define mp_isodd(a) mp_get_bit((a),0)
+#define mp_iseven(a) (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
+#define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
#define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO)
/* set to zero */
@@ -294,7 +286,7 @@ int mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c);
int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c);
/* right shift (two complement) */
-int mp_tc_div_2d(const mp_int *a, int b, mp_int *c);
+int mp_signed_rsh(const mp_int *a, int b, mp_int *c);
/* ---> Basic arithmetic <--- */