mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 16:57:35 +02:00
WIP
This commit is contained in:
parent
8c4ec056c8
commit
50f2c34f4a
1 changed files with 6 additions and 4 deletions
10
runtime.c
10
runtime.c
|
@ -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 */
|
||||||
|
|
Loading…
Add table
Reference in a new issue