fixing bignum integer-length for real

This commit is contained in:
Alex Shinn 2012-06-10 23:06:44 +09:00
parent dc70094472
commit 06d82e5695

View file

@ -266,8 +266,8 @@ static sexp sexp_integer_length (sexp ctx, sexp self, sexp_sint_t n, sexp x) {
#if SEXP_USE_BIGNUMS #if SEXP_USE_BIGNUMS
} else if (sexp_bignump(x)) { } else if (sexp_bignump(x)) {
hi = sexp_bignum_hi(x); hi = sexp_bignum_hi(x);
return sexp_make_fixnum(integer_log2(sexp_bignum_data(x)[hi]) return sexp_make_fixnum(integer_log2(sexp_bignum_data(x)[hi-1])
+ hi*sizeof(sexp_uint_t)*CHAR_BIT); + (hi-1)*sizeof(sexp_uint_t)*CHAR_BIT);
#endif #endif
} else { } else {
return sexp_type_exception(ctx, self, SEXP_FIXNUM, x); return sexp_type_exception(ctx, self, SEXP_FIXNUM, x);