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 8e245e71..b1ae1677 100644
--- a/arith.c
+++ b/arith.c
@@ -68,6 +68,17 @@ val bignum(cnum cn)
return n;
}
+val bignum_from_long(long l)
+{
+#if SIZEOF_LONG <= SIZEOF_PTR
+ return bignum(l);
+#else
+ val n = make_bignum();
+ mp_set_int(mp(n), l);
+ return n;
+#endif
+}
+
#if HAVE_DOUBLE_INTPTR_T
static val bignum_dbl_ipt(double_intptr_t di)