Compile bignum consts

This commit is contained in:
Justin Ethier 2017-02-17 18:28:32 +00:00
parent 9c18d6d2b9
commit 470fb17465

View file

@ -472,6 +472,19 @@
(c-compile-vector exp))
((bytevector? exp)
(c-compile-bytevector exp))
((bignum? exp)
(let ((cvar-name (mangle (gensym 'c)))
(num2str (cond
(else
(number->string exp)))))
(c-code/vars
(string-append "" cvar-name) ; Code is just the variable name
(list ; Allocate pointer on the C stack
(string-append
"alloc_bignum(data, " cvar-name "); "
;; TODO: need error checking, this is just a first cut:
"mp_read_radix(&bignum_value(" cvar-name "), \"" num2str "\", 10);"))))
)
((integer? exp)
; (let ((cvar-name (mangle (gensym 'c))))
; (c-code/vars