From ad51bc7e807742d959f9eb3401a42bfb7c7505c9 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 16 Feb 2017 02:38:57 -0500 Subject: [PATCH] Preliminary bignum integration --- include/cyclone/runtime.h | 4 ++++ include/cyclone/types.h | 1 + 2 files changed, 5 insertions(+) diff --git a/include/cyclone/runtime.h b/include/cyclone/runtime.h index e0ca4430..045d672e 100644 --- a/include/cyclone/runtime.h +++ b/include/cyclone/runtime.h @@ -100,6 +100,8 @@ object Cyc_global_set(void *thd, object * glo, object value); d.value = OP(obj_obj2int(z)); \ } else if (type_of(z) == integer_tag) { \ d.value = OP(((integer_type *)z)->value); \ + } else if (type_of(z) == bignum_tag) { \ + d.value = OP(mp_get_double(&bignum_value(z))); \ } else { \ d.value = OP(((double_type *)z)->value); \ } \ @@ -112,6 +114,8 @@ object Cyc_global_set(void *thd, object * glo, object value); i = obj_obj2int(z); \ } else if (type_of(z) == integer_tag) { \ i = (int)OP(((integer_type *)z)->value); \ + } else if (type_of(z) == bignum_tag) { \ + return_closcall1(data, cont, z); \ } else { \ i = (int)OP(((double_type *)z)->value); \ } \ diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 542b4cbf..5e43a96e 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -680,6 +680,7 @@ typedef union { void **vpbuffer_realloc(void **buf, int *len); void **vpbuffer_add(void **buf, int *len, int i, void *obj); void vpbuffer_free(void **buf); +double mp_get_double(mp_int *a); /* GC prototypes */ void gc_initialize();