summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-01-25 06:33:29 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-01-25 06:33:29 -0800
commit4c71a77f2c39a8158c80b40af1a5cc2358251a00 (patch)
treef3c49877aed2a6898b89662f06a17cbc06c080ca /lib.c
parent8195fbed4a8067362656d38e56fec3c4eb3deef1 (diff)
downloadtxr-4c71a77f2c39a8158c80b40af1a5cc2358251a00.tar.gz
txr-4c71a77f2c39a8158c80b40af1a5cc2358251a00.tar.bz2
txr-4c71a77f2c39a8158c80b40af1a5cc2358251a00.zip
Provide faster bignum-in-fixed-integer range tests in MPI.
* mpi/mpi.c (mp_in_range, mp_in_intptr_range, mp_in_uintptr_range): New functions. * mpi/mpi.h (mp_in_range, mp_in_intptr_range, mp_in_uintptr_range): Declared. * arith.c (NUM_MAX_MP, INT_PTR_MAX_MP, UINT_PTR_MAX_MP, INT_PTR_MAX_SUCC_MP): Static variables removed. Note that INT_PTR_MAX_MP was not used at all! (normalize): Use mp_in_range instead magnitude comparison to NUM_MAX_MP. (in_int_ptr_range, in_uint_ptr_range): Static functions removed. (c_unum): Use mp_in_uintptr_range instead of in_uint_ptr_range. (arith_init): Remove initializations of removed variables. (arith_free_all): Remove cleanup of removed variables, leaving function empty. * lib.c (c_num): Use mp_in_intptr_range instead of in_int_ptr_range.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 26806b41..7e4edd9c 100644
--- a/lib.c
+++ b/lib.c
@@ -3105,7 +3105,7 @@ cnum c_num(val n)
case CHR: case NUM:
return coerce(cnum, n) >> TAG_SHIFT;
case BGNUM:
- if (in_int_ptr_range(n)) {
+ if (mp_in_intptr_range(mp(n))) {
int_ptr_t out;
mp_get_intptr(mp(n), &out);
return out;