From 6ca990016a21b51a5d4255e62605c7bfc4c1b05c Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Tue, 5 Jun 2012 00:16:22 +0900 Subject: [PATCH] Fixing bug in bignum<->fixnum bitwise-[ix]or modifying inputs instead of outputs (oops). --- lib/srfi/33/bit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/srfi/33/bit.c b/lib/srfi/33/bit.c index d73a79ad..ddc32686 100644 --- a/lib/srfi/33/bit.c +++ b/lib/srfi/33/bit.c @@ -70,7 +70,7 @@ static sexp sexp_bit_ior (sexp ctx, sexp self, sexp_sint_t n, sexp x, sexp y) { } else if (sexp_bignump(x)) { if (sexp_fixnump(y)) { res = sexp_copy_bignum(ctx, NULL, x, 0); - sexp_bignum_data(x)[0] |= sexp_unbox_fixnum(y); + sexp_bignum_data(res)[0] |= (sexp_uint_t)sexp_unbox_fixnum(y); } else if (sexp_bignump(y)) { if (sexp_bignum_length(x) >= sexp_bignum_length(y)) { res = sexp_copy_bignum(ctx, NULL, x, 0); @@ -110,7 +110,7 @@ static sexp sexp_bit_xor (sexp ctx, sexp self, sexp_sint_t n, sexp x, sexp y) { } else if (sexp_bignump(x)) { if (sexp_fixnump(y)) { res = sexp_copy_bignum(ctx, NULL, x, 0); - sexp_bignum_data(x)[0] ^= sexp_unbox_fixnum(y); + sexp_bignum_data(res)[0] ^= sexp_unbox_fixnum(y); } else if (sexp_bignump(y)) { if (sexp_bignum_length(x) >= sexp_bignum_length(y)) { res = sexp_copy_bignum(ctx, NULL, x, 0);