mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
Fixing bug in bignum<->fixnum bitwise-[ix]or modifying inputs instead of outputs (oops).
This commit is contained in:
parent
fa0c699a6c
commit
6ca990016a
1 changed files with 2 additions and 2 deletions
|
@ -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)) {
|
} else if (sexp_bignump(x)) {
|
||||||
if (sexp_fixnump(y)) {
|
if (sexp_fixnump(y)) {
|
||||||
res = sexp_copy_bignum(ctx, NULL, x, 0);
|
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)) {
|
} else if (sexp_bignump(y)) {
|
||||||
if (sexp_bignum_length(x) >= sexp_bignum_length(y)) {
|
if (sexp_bignum_length(x) >= sexp_bignum_length(y)) {
|
||||||
res = sexp_copy_bignum(ctx, NULL, x, 0);
|
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)) {
|
} else if (sexp_bignump(x)) {
|
||||||
if (sexp_fixnump(y)) {
|
if (sexp_fixnump(y)) {
|
||||||
res = sexp_copy_bignum(ctx, NULL, x, 0);
|
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)) {
|
} else if (sexp_bignump(y)) {
|
||||||
if (sexp_bignum_length(x) >= sexp_bignum_length(y)) {
|
if (sexp_bignum_length(x) >= sexp_bignum_length(y)) {
|
||||||
res = sexp_copy_bignum(ctx, NULL, x, 0);
|
res = sexp_copy_bignum(ctx, NULL, x, 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue