mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
WIP
This commit is contained in:
parent
670d5a0e98
commit
8c4ec056c8
1 changed files with 14 additions and 1 deletions
15
runtime.c
15
runtime.c
|
@ -3105,7 +3105,20 @@ object Cyc_expt(void *data, object cont, object z1, object z2)
|
|||
// TODO: convert bignum back to fixnum if possible
|
||||
object Cyc_bignum_normalize(void *data, object n)
|
||||
{
|
||||
return n;
|
||||
mp_int bn;
|
||||
if (!is_object_type(n) || type_of(n) != bignum_tag) {
|
||||
return n;
|
||||
}
|
||||
|
||||
mp_init(&bn);
|
||||
mp_set_int(&bn, CYC_FIXNUM_MAX);
|
||||
if (mp_cmp_mag(&bignum_value(n), &bn) == MP_GT) {
|
||||
mp_clear(&bn);
|
||||
return n;
|
||||
} else {
|
||||
mp_clear(&bn);
|
||||
return obj_obj2int( TODO: get signed bignum int value
|
||||
}
|
||||
}
|
||||
|
||||
/* I/O functions */
|
||||
|
|
Loading…
Add table
Reference in a new issue