mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
numeric.c: fix smallint op bigint error in bitwise logical operators.
This commit is contained in:
@@ -1382,6 +1382,9 @@ int_and(mrb_state *mrb, mrb_value x)
|
||||
if (mrb_bigint_p(x)) {
|
||||
return mrb_bint_and(mrb, x, y);
|
||||
}
|
||||
if (mrb_bigint_p(y)) {
|
||||
return mrb_bint_and(mrb, mrb_as_bint(mrb, x), y);
|
||||
}
|
||||
#endif
|
||||
bit_op(x, y, and, &);
|
||||
}
|
||||
@@ -1403,6 +1406,9 @@ int_or(mrb_state *mrb, mrb_value x)
|
||||
if (mrb_bigint_p(x)) {
|
||||
return mrb_bint_or(mrb, x, y);
|
||||
}
|
||||
if (mrb_bigint_p(y)) {
|
||||
return mrb_bint_or(mrb, mrb_as_bint(mrb, x), y);
|
||||
}
|
||||
#endif
|
||||
bit_op(x, y, or, |);
|
||||
}
|
||||
@@ -1424,6 +1430,9 @@ int_xor(mrb_state *mrb, mrb_value x)
|
||||
if (mrb_bigint_p(x)) {
|
||||
return mrb_bint_xor(mrb, x, y);
|
||||
}
|
||||
if (mrb_bigint_p(y)) {
|
||||
return mrb_bint_xor(mrb, mrb_as_bint(mrb, x), y);
|
||||
}
|
||||
#endif
|
||||
bit_op(x, y, or, ^);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user