mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 12:35:05 +02:00
WIP
This commit is contained in:
parent
670d5a0e98
commit
8c4ec056c8
1 changed files with 14 additions and 1 deletions
13
runtime.c
13
runtime.c
|
@ -3105,9 +3105,22 @@ object Cyc_expt(void *data, object cont, object z1, object z2)
|
||||||
// TODO: convert bignum back to fixnum if possible
|
// TODO: convert bignum back to fixnum if possible
|
||||||
object Cyc_bignum_normalize(void *data, object n)
|
object Cyc_bignum_normalize(void *data, object n)
|
||||||
{
|
{
|
||||||
|
mp_int bn;
|
||||||
|
if (!is_object_type(n) || type_of(n) != bignum_tag) {
|
||||||
return n;
|
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 */
|
/* I/O functions */
|
||||||
|
|
||||||
port_type Cyc_stdout()
|
port_type Cyc_stdout()
|
||||||
|
|
Loading…
Add table
Reference in a new issue