This commit is contained in:
Justin Ethier 2017-02-16 04:45:27 -05:00
parent 8c4ec056c8
commit 50f2c34f4a

View file

@ -3106,6 +3106,7 @@ object Cyc_expt(void *data, object cont, object z1, object z2)
object Cyc_bignum_normalize(void *data, object n) object Cyc_bignum_normalize(void *data, object n)
{ {
mp_int bn; mp_int bn;
object result;
if (!is_object_type(n) || type_of(n) != bignum_tag) { if (!is_object_type(n) || type_of(n) != bignum_tag) {
return n; return n;
} }
@ -3113,12 +3114,13 @@ object Cyc_bignum_normalize(void *data, object n)
mp_init(&bn); mp_init(&bn);
mp_set_int(&bn, CYC_FIXNUM_MAX); mp_set_int(&bn, CYC_FIXNUM_MAX);
if (mp_cmp_mag(&bignum_value(n), &bn) == MP_GT) { if (mp_cmp_mag(&bignum_value(n), &bn) == MP_GT) {
mp_clear(&bn); result = n;
return n;
} else { } else {
mp_clear(&bn); result = return obj_obj2int( TODO: get signed bignum int value
return obj_obj2int( TODO: get signed bignum int value
} }
mp_clear(&bn);
return result;
} }
/* I/O functions */ /* I/O functions */