/** rb_big_lshift * */ @Override public IRubyObject op_lshift(ThreadContext context, IRubyObject other) { long shift; for (;;) { if (other instanceof RubyFixnum) { shift = ((RubyFixnum) other).getLongValue(); break; } else if (other instanceof RubyBignum) { RubyBignum otherBignum = (RubyBignum) other; if (otherBignum.value.signum() < 0) { IRubyObject tmp = otherBignum.checkShiftDown(context, this); if (tmp != null) return tmp; } shift = big2long(otherBignum); break; } other = other.convertToInteger(); } return op_lshift(context, shift); }
/** rb_big_rshift * */ @Override public IRubyObject op_rshift(ThreadContext context, IRubyObject other) { long shift; for (;;) { if (other instanceof RubyFixnum) { shift = ((RubyFixnum) other).getLongValue(); break; } else if (other instanceof RubyBignum) { RubyBignum otherBignum = (RubyBignum) other; if (otherBignum.value.signum() >= 0) { IRubyObject tmp = otherBignum.checkShiftDown(context, this); if (tmp != null) return tmp; } shift = big2long(otherBignum); break; } other = other.convertToInteger(); } return op_rshift(context, shift); }
/** rb_big_rshift * */ @Override public IRubyObject op_rshift(ThreadContext context, IRubyObject other) { long shift; for (;;) { if (other instanceof RubyFixnum) { shift = ((RubyFixnum) other).getLongValue(); break; } else if (other instanceof RubyBignum) { RubyBignum otherBignum = (RubyBignum) other; if (otherBignum.value.signum() >= 0) { IRubyObject tmp = otherBignum.checkShiftDown(context, this); if (tmp != null) return tmp; } shift = big2long(otherBignum); break; } other = other.convertToInteger(); } return op_rshift(context, shift); }
/** rb_big_lshift * */ @Override public IRubyObject op_lshift(ThreadContext context, IRubyObject other) { long shift; for (;;) { if (other instanceof RubyFixnum) { shift = ((RubyFixnum) other).getLongValue(); break; } else if (other instanceof RubyBignum) { RubyBignum otherBignum = (RubyBignum) other; if (otherBignum.value.signum() < 0) { IRubyObject tmp = otherBignum.checkShiftDown(context, this); if (tmp != null) return tmp; } shift = big2long(otherBignum); break; } other = other.convertToInteger(); } return op_lshift(context, shift); }
/** rb_big_lshift * */ @JRubyMethod(name = "<<", required = 1) public IRubyObject op_lshift(IRubyObject other) { long shift; boolean neg = false; for (;;) { if (other instanceof RubyFixnum) { shift = ((RubyFixnum)other).getLongValue(); if (shift < 0) { neg = true; shift = -shift; } break; } else if (other instanceof RubyBignum) { RubyBignum otherBignum = (RubyBignum)other; if (otherBignum.value.signum() < 0) { IRubyObject tmp = otherBignum.checkShiftDown(this); if (!tmp.isNil()) return tmp; neg = true; } shift = big2long(otherBignum); break; } other = other.convertToInteger(); } return bignorm(getRuntime(), neg ? value.shiftRight((int)shift) : value.shiftLeft((int)shift)); }
/** rb_big_lshift * */ @JRubyMethod(name = "<<", required = 1) public IRubyObject op_lshift(IRubyObject other) { long shift; boolean neg = false; for (;;) { if (other instanceof RubyFixnum) { shift = ((RubyFixnum)other).getLongValue(); if (shift < 0) { neg = true; shift = -shift; } break; } else if (other instanceof RubyBignum) { RubyBignum otherBignum = (RubyBignum)other; if (otherBignum.value.signum() < 0) { IRubyObject tmp = otherBignum.checkShiftDown(this); if (!tmp.isNil()) return tmp; neg = true; } shift = big2long(otherBignum); break; } other = other.convertToInteger(); } return bignorm(getRuntime(), neg ? value.shiftRight((int)shift) : value.shiftLeft((int)shift)); }
/** rb_big_rshift * */ @JRubyMethod(name = ">>", required = 1) public IRubyObject op_rshift(IRubyObject other) { long shift; boolean neg = false; for (;;) { if (other instanceof RubyFixnum) { shift = ((RubyFixnum)other).getLongValue(); if (shift < 0) { neg = true; shift = -shift; } break; } else if (other instanceof RubyBignum) { RubyBignum otherBignum = (RubyBignum)other; if (otherBignum.value.signum() >= 0) { IRubyObject tmp = otherBignum.checkShiftDown(this); if (!tmp.isNil()) return tmp; } else { neg = true; } shift = big2long(otherBignum); break; } other = other.convertToInteger(); } return bignorm(getRuntime(), neg ? value.shiftLeft((int)shift) : value.shiftRight((int)shift)); }
/** rb_big_rshift * */ @JRubyMethod(name = ">>", required = 1) public IRubyObject op_rshift(IRubyObject other) { long shift; boolean neg = false; for (;;) { if (other instanceof RubyFixnum) { shift = ((RubyFixnum)other).getLongValue(); if (shift < 0) { neg = true; shift = -shift; } break; } else if (other instanceof RubyBignum) { RubyBignum otherBignum = (RubyBignum)other; if (otherBignum.value.signum() >= 0) { IRubyObject tmp = otherBignum.checkShiftDown(this); if (!tmp.isNil()) return tmp; } else { neg = true; } shift = big2long(otherBignum); break; } other = other.convertToInteger(); } return bignorm(getRuntime(), neg ? value.shiftLeft((int)shift) : value.shiftRight((int)shift)); }