summaryrefslogtreecommitdiffstats
path: root/arith.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-01-25 06:59:29 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-01-25 06:59:29 -0800
commit4b789435f8e4bb6ec9ea4bab3d0a109682adafa6 (patch)
tree65f91721ae512480ea4df6b9f7f493b35eab6660 /arith.h
parent4c71a77f2c39a8158c80b40af1a5cc2358251a00 (diff)
downloadtxr-4b789435f8e4bb6ec9ea4bab3d0a109682adafa6.tar.gz
txr-4b789435f8e4bb6ec9ea4bab3d0a109682adafa6.tar.bz2
txr-4b789435f8e4bb6ec9ea4bab3d0a109682adafa6.zip
Extend infrastructure for double_intptr_t.
We support an unsigned version of the type, and add functions for converting between Lisp values and both types. * arith.c (bignum_dbl_uipt): New function, unsigned companion to existing bignum_dbl_ipt. (c_dbl_num, c_dbl_unum): New functions. * arith.h (bignum_dbl_uipt, c_dbl_num, c_dbl_unum): Declared. * configure (superulong_t, SIZEOF_DOUBLE_INTPTR, DOUBLE_INTPTR_MAX, DOUBLE_INTPTR_MIN, DOUBLE_UINTPTR_MAX, double_uintptr_t): New definitions going into config.h. * lib.h (dbl_cnum, dbl_ucnum): New typedefs: double-sized analogs of cnum and ucnum. * mpi/mpi.c (mp_set_double_uintptr, mp_get_double_uintptr, mp_get_double_intptr): New functions. (s_mp_in_big_range): New static function. (mp_in_double_intptr_range, mp_in_double_uintptr_range): New functions. * mpi/mpi.h (mp_set_double_uintptr, mp_get_double_intptr, mp_get_double_uintptr, mp_in_double_intptr_range, mp_in_double_uintptr_range): Declared.
Diffstat (limited to 'arith.h')
-rw-r--r--arith.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arith.h b/arith.h
index 919de83c..e57c368e 100644
--- a/arith.h
+++ b/arith.h
@@ -35,10 +35,15 @@ int highest_bit(int_ptr_t n);
val normalize(val bignum);
#if HAVE_DOUBLE_INTPTR_T
val bignum_dbl_ipt(double_intptr_t di);
+val bignum_dbl_uipt(double_uintptr_t dui);
#endif
val in_int_ptr_range(val bignum);
ucnum c_unum(val num);
val unum(ucnum u);
+#if HAVE_DOUBLE_INTPTR_T
+double_intptr_t c_dbl_num(val num);
+double_uintptr_t c_dbl_unum(val num);
+#endif
val bignum_len(val num);
val cum_norm_dist(val x);
val inv_cum_norm(val p);