summaryrefslogtreecommitdiffstats
path: root/arith.c
diff options
context:
space:
mode:
Diffstat (limited to 'arith.c')
-rw-r--r--arith.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arith.c b/arith.c
index 5678453d..c17ab743 100644
--- a/arith.c
+++ b/arith.c
@@ -179,6 +179,17 @@ ucnum c_unum(val num)
}
}
+val unum(ucnum u)
+{
+ if (u <= INT_PTR_MAX) {
+ return num(u);
+ } else {
+ val n = make_bignum();
+ mp_set_uintptr(mp(n), u);
+ return n;
+ }
+}
+
int highest_bit(int_ptr_t n)
{
#if SIZEOF_PTR == 8