mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 20:45:06 +02:00
Compile bignum consts
This commit is contained in:
parent
9c18d6d2b9
commit
470fb17465
1 changed files with 13 additions and 0 deletions
|
@ -472,6 +472,19 @@
|
||||||
(c-compile-vector exp))
|
(c-compile-vector exp))
|
||||||
((bytevector? exp)
|
((bytevector? exp)
|
||||||
(c-compile-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)
|
((integer? exp)
|
||||||
; (let ((cvar-name (mangle (gensym 'c))))
|
; (let ((cvar-name (mangle (gensym 'c))))
|
||||||
; (c-code/vars
|
; (c-code/vars
|
||||||
|
|
Loading…
Add table
Reference in a new issue