diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-01-23 06:45:48 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-01-23 06:45:48 -0800 |
commit | f64d0bb5e0bfff833936d63849f86510a2328fee (patch) | |
tree | 8ee068483ea05129096a8e82a7c240d2f5cb2908 | |
parent | 60e58b45da4926490e21cdfd7bfe9c8d48832f70 (diff) | |
download | txr-f64d0bb5e0bfff833936d63849f86510a2328fee.tar.gz txr-f64d0bb5e0bfff833936d63849f86510a2328fee.tar.bz2 txr-f64d0bb5e0bfff833936d63849f86510a2328fee.zip |
sysif: use double-intptr function from arith.
* arith.c (bignum_dbl_ipt): Change internal function to
external linkage.
* arith.h (bignum_dbl_ipt): Conditionally declared.
* sysif.c (num_off_t): Use bignum_dbl_ipt instead of
open-coding exactly the same thing that bignum_dbl_ipt does.
Abort is changed to same internal_error as in off_t_num.
-rw-r--r-- | arith.c | 2 | ||||
-rw-r--r-- | arith.h | 3 | ||||
-rw-r--r-- | sysif.c | 6 |
3 files changed, 6 insertions, 5 deletions
@@ -154,7 +154,7 @@ int num_to_buffer(val num, mem_t *buf, int bytes) #if HAVE_DOUBLE_INTPTR_T -static val bignum_dbl_ipt(double_intptr_t di) +val bignum_dbl_ipt(double_intptr_t di) { val n = make_bignum(); mp_set_double_intptr(mp(n), di); @@ -33,6 +33,9 @@ val num_from_buffer(mem_t *buf, int bytes); int num_to_buffer(val num, mem_t *buf, int bytes); int highest_bit(int_ptr_t n); val normalize(val bignum); +#if HAVE_DOUBLE_INTPTR_T +val bignum_dbl_ipt(double_intptr_t di); +#endif val in_int_ptr_range(val bignum); ucnum c_unum(val num); val unum(ucnum u); @@ -1351,11 +1351,9 @@ val num_off_t(off_t off) } else { #if HAVE_DOUBLE_INTPTR_T if (sizeof (off_t) <= sizeof (double_intptr_t)) { - val n = make_bignum(); - mp_set_double_intptr(mp(n), off); - return n; + return bignum_dbl_ipt(off); } else { - abort(); + internal_error("portme: unsupported off_t size"); } #else #error port me! |