cify: repair bytes-ref and bignum handling

These problems were exposed by cifying `racket/fasl`.
This commit is contained in:
Matthew Flatt 2018-11-23 08:03:13 -07:00
parent f47f685af9
commit d6802444fa
2 changed files with 10 additions and 1 deletions

View File

@ -977,6 +977,15 @@
(cond
[(always-fixnum? 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_minus_inf_object"]
[(eqv? e +nan.0) "scheme_nan_object"]

View File

@ -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)
{
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);
}