cify: repair bytes-ref
and bignum handling
These problems were exposed by cifying `racket/fasl`.
This commit is contained in:
parent
f47f685af9
commit
d6802444fa
|
@ -977,6 +977,15 @@
|
||||||
(cond
|
(cond
|
||||||
[(always-fixnum? e)
|
[(always-fixnum? e)
|
||||||
(format "scheme_make_integer(~a)" e)]
|
(format "scheme_make_integer(~a)" e)]
|
||||||
|
[(exact-integer? e)
|
||||||
|
(cond
|
||||||
|
[(and (< e (expt 2 63))
|
||||||
|
(>= e (- (expt 2 63))))
|
||||||
|
(format "scheme_make_integer_value_from_long_halves(~aL, ~aL)"
|
||||||
|
(bitwise-and e (sub1 (expt 2 32)))
|
||||||
|
(arithmetic-shift e -32))]
|
||||||
|
[else
|
||||||
|
(error 'generate-quite "number is too large: ~e" e)])]
|
||||||
[(eqv? e +inf.0) "scheme_inf_object"]
|
[(eqv? e +inf.0) "scheme_inf_object"]
|
||||||
[(eqv? e -inf.0) "scheme_minus_inf_object"]
|
[(eqv? e -inf.0) "scheme_minus_inf_object"]
|
||||||
[(eqv? e +nan.0) "scheme_nan_object"]
|
[(eqv? e +nan.0) "scheme_nan_object"]
|
||||||
|
|
|
@ -482,7 +482,7 @@ static MZ_INLINE Scheme_Object *c_string_ref(Scheme_Object *v, Scheme_Object *i)
|
||||||
|
|
||||||
static MZ_INLINE Scheme_Object *c_bytes_ref(Scheme_Object *v, Scheme_Object *i)
|
static MZ_INLINE Scheme_Object *c_bytes_ref(Scheme_Object *v, Scheme_Object *i)
|
||||||
{
|
{
|
||||||
int c = SCHEME_BYTE_STR_VAL(v)[SCHEME_INT_VAL(i)];
|
int c = ((unsigned char *)SCHEME_BYTE_STR_VAL(v))[SCHEME_INT_VAL(i)];
|
||||||
return scheme_make_integer(c);
|
return scheme_make_integer(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user