summaryrefslogtreecommitdiffstats
path: root/libtommath/tommath.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-07-05 14:54:17 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-07-05 14:54:17 (GMT)
commitc7329913d9a9958b515d0c99764dd79ed3e85fb2 (patch)
tree65682ee7f392983c83336884e1415ae43ee02002 /libtommath/tommath.h
parentdb7fa65dce753b80d5f2a87799aabd481e9144a2 (diff)
parent508e022fa975ee61d6aef292a45eabccc2e3d662 (diff)
downloadtcl-c7329913d9a9958b515d0c99764dd79ed3e85fb2.zip
tcl-c7329913d9a9958b515d0c99764dd79ed3e85fb2.tar.gz
tcl-c7329913d9a9958b515d0c99764dd79ed3e85fb2.tar.bz2
Merge libtommath
Diffstat (limited to 'libtommath/tommath.h')
-rw-r--r--libtommath/tommath.h51
1 files changed, 32 insertions, 19 deletions
diff --git a/libtommath/tommath.h b/libtommath/tommath.h
index 26f5416..982470f 100644
--- a/libtommath/tommath.h
+++ b/libtommath/tommath.h
@@ -274,14 +274,14 @@ double mp_get_double(const mp_int *a) MP_WUR;
mp_err mp_set_double(mp_int *a, double b) MP_WUR;
/* get integer, set integer and init with integer () */
-int mp_get_i32(const mp_int *a) MP_WUR;
-void mp_set_i32(mp_int *a, int b);
-mp_err mp_init_i32(mp_int *a, int b) MP_WUR;
+long mp_get_i32(const mp_int *a) MP_WUR;
+void mp_set_i32(mp_int *a, long b);
+mp_err mp_init_i32(mp_int *a, long b) MP_WUR;
/* get integer, set integer and init with integer, behaves like two complement for negative numbers (unsigned int) */
-#define mp_get_u32(a) ((unsigned int)mp_get_i32(a))
-void mp_set_u32(mp_int *a, unsigned int b);
-mp_err mp_init_u32(mp_int *a, unsigned int b) MP_WUR;
+#define mp_get_u32(a) ((unsigned long)mp_get_i32(a))
+void mp_set_u32(mp_int *a, unsigned long b);
+mp_err mp_init_u32(mp_int *a, unsigned long b) MP_WUR;
/* get integer, set integer and init with integer (long long) */
long long mp_get_i64(const mp_int *a) MP_WUR;
@@ -294,30 +294,43 @@ void mp_set_u64(mp_int *a, unsigned long long b);
mp_err mp_init_u64(mp_int *a, unsigned long long b) MP_WUR;
/* get magnitude */
-unsigned int mp_get_mag32(const mp_int *a) MP_WUR;
-unsigned long long mp_get_mag64(const mp_int *a) MP_WUR;
+unsigned long mp_get_mag_u32(const mp_int *a) MP_WUR;
+unsigned long long mp_get_mag_u64(const mp_int *a) MP_WUR;
+unsigned long mp_get_mag_ul(const mp_int *a) MP_WUR;
+unsigned long long mp_get_mag_ull(const mp_int *a) MP_WUR;
/* get integer, set integer (long) */
-#define mp_get_l(a) (sizeof (long) == 8 ? (long)mp_get_i64(a) : (long)mp_get_i32(a))
-#define mp_set_l(a, b) (sizeof (long) == 8 ? mp_set_i64((a), (b)) : mp_set_i32((a), (int)(b)))
+long mp_get_l(const mp_int *a) MP_WUR;
+void mp_set_l(mp_int *a, long b);
+mp_err mp_init_l(mp_int *a, long b) MP_WUR;
/* get integer, set integer (unsigned long) */
-#define mp_get_ul(a) (sizeof (long) == 8 ? (unsigned long)mp_get_u64(a) : (unsigned long)mp_get_u32(a))
-#define mp_set_ul(a, b) (sizeof (long) == 8 ? mp_set_u64((a), (b)) : mp_set_u32((a), (unsigned int)(b)))
-#define mp_get_magl(a) (sizeof (long) == 8 ? (unsigned long)mp_get_mag64(a) : (unsigned long)mp_get_mag32(a))
+#define mp_get_ul(a) ((unsigned long)mp_get_l(a))
+void mp_set_ul(mp_int *a, unsigned long b);
+mp_err mp_init_ul(mp_int *a, unsigned long b) MP_WUR;
+
+/* get integer, set integer (long long) */
+long long mp_get_ll(const mp_int *a) MP_WUR;
+void mp_set_ll(mp_int *a, long long b);
+mp_err mp_init_ll(mp_int *a, long long b) MP_WUR;
+
+/* get integer, set integer (unsigned long long) */
+#define mp_get_ull(a) ((unsigned long long)mp_get_ll(a))
+void mp_set_ull(mp_int *a, unsigned long long b);
+mp_err mp_init_ull(mp_int *a, unsigned long long b) MP_WUR;
/* set to single unsigned digit, up to MP_DIGIT_MAX */
void mp_set(mp_int *a, mp_digit b);
mp_err mp_init_set(mp_int *a, mp_digit b) MP_WUR;
/* get integer, set integer and init with integer (deprecated) */
-MP_DEPRECATED(mp_get_mag32/mp_get_u32) unsigned long mp_get_int(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_get_magl/mp_get_ul) unsigned long mp_get_long(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_get_mag64/mp_get_u64) unsigned long long mp_get_long_long(const mp_int *a) MP_WUR;
-MP_DEPRECATED(mp_set_u32) mp_err mp_set_int(mp_int *a, unsigned long b);
+MP_DEPRECATED(mp_get_mag_u32/mp_get_u32) unsigned long mp_get_int(const mp_int *a) MP_WUR;
+MP_DEPRECATED(mp_get_mag_ul/mp_get_ul) unsigned long mp_get_long(const mp_int *a) MP_WUR;
+MP_DEPRECATED(mp_get_mag_ull/mp_get_ull) unsigned long long mp_get_long_long(const mp_int *a) MP_WUR;
+MP_DEPRECATED(mp_set_ul) mp_err mp_set_int(mp_int *a, unsigned long b);
MP_DEPRECATED(mp_set_ul) mp_err mp_set_long(mp_int *a, unsigned long b);
-MP_DEPRECATED(mp_set_u64) mp_err mp_set_long_long(mp_int *a, unsigned long long b);
-MP_DEPRECATED(mp_init_u32) mp_err mp_init_set_int(mp_int *a, unsigned long b) MP_WUR;
+MP_DEPRECATED(mp_set_ull) mp_err mp_set_long_long(mp_int *a, unsigned long long b);
+MP_DEPRECATED(mp_init_ul) mp_err mp_init_set_int(mp_int *a, unsigned long b) MP_WUR;
/* copy, b = a */
mp_err mp_copy(const mp_int *a, mp_int *b) MP_WUR;