* string->flonum now uses bytevectors as intermediate rep.
This commit is contained in:
parent
7ca0ddfa81
commit
691a42fe4e
BIN
bin/ikarus
BIN
bin/ikarus
Binary file not shown.
|
@ -5,16 +5,16 @@
|
|||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
ikp
|
||||
ikrt_string_to_flonum(ikp x, ikpcb* pcb){
|
||||
double v = strtod(string_data(x), NULL);
|
||||
ikrt_bytevector_to_flonum(ikp x, ikpcb* pcb){
|
||||
double v = strtod((char*)x+off_bytevector_data, NULL);
|
||||
ikp r = ik_alloc(pcb, flonum_size) + vector_tag;
|
||||
ref(r, -vector_tag) = (ikp)flonum_tag;
|
||||
flonum_data(r) = v;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
ikp
|
||||
ikrt_fl_plus(ikp x, ikp y,ikpcb* pcb){
|
||||
ikp r = ik_alloc(pcb, flonum_size) + vector_tag;
|
||||
|
|
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -13,12 +13,14 @@
|
|||
(define (flonum->string x)
|
||||
(utf8-bytevector->string
|
||||
(or (foreign-call "ikrt_flonum_to_bytevector" x
|
||||
(make-bytevector 80 0))
|
||||
($make-bytevector 80))
|
||||
(error 'flonum->string "~s is not a flonum" x))))
|
||||
|
||||
(define (string->flonum x)
|
||||
(cond
|
||||
[(string? x) (foreign-call "ikrt_string_to_flonum" x)]
|
||||
[(string? x)
|
||||
(foreign-call "ikrt_bytevector_to_flonum"
|
||||
(string->utf8-bytevector x))]
|
||||
[else
|
||||
(error 'string->flonum "~s is not a string" x)])))
|
||||
|
||||
|
|
Loading…
Reference in New Issue