/** fix_lshift * */ @Override public IRubyObject op_lshift(ThreadContext context, IRubyObject other) { if (!(other instanceof RubyFixnum)) { return RubyBignum.newBignum(context.runtime, value).op_lshift(context, other); } return op_lshift(context, ((RubyFixnum) other).value); }
/** fix_lshift * */ @Override public IRubyObject op_lshift(ThreadContext context, IRubyObject other) { if (!(other instanceof RubyFixnum)) { return RubyBignum.newBignum(context.runtime, value).op_lshift(context, other); } return op_lshift(context, ((RubyFixnum) other).value); }
private RubyInteger lshift(ThreadContext context, final long width) { if (width > BIT_SIZE - 1 || ((~0L << BIT_SIZE - width - 1) & value) != 0) { return RubyBignum.newBignum(context.runtime, value).op_lshift(context, width); } return RubyFixnum.newFixnum(context.runtime, value << width); }
private RubyInteger lshift(ThreadContext context, final long width) { if (width > BIT_SIZE - 1 || ((~0L << BIT_SIZE - width - 1) & value) != 0) { return RubyBignum.newBignum(context.runtime, value).op_lshift(context, width); } return RubyFixnum.newFixnum(context.runtime, value << width); }
/** 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 * */ @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); }
/** fix_lshift * */ @JRubyMethod(name = "<<") public IRubyObject op_lshift(IRubyObject other) { if (!(other instanceof RubyFixnum)) return RubyBignum.newBignum(getRuntime(), value).op_lshift(other); return op_lshift(((RubyFixnum)other).getLongValue()); }
/** fix_lshift * */ @JRubyMethod(name = "<<") public IRubyObject op_lshift(IRubyObject other) { if (!(other instanceof RubyFixnum)) return RubyBignum.newBignum(getRuntime(), value).op_lshift(other); return op_lshift(((RubyFixnum)other).getLongValue()); }
private IRubyObject lshift(long width) { if (width > BIT_SIZE - 1 || ((~0L << BIT_SIZE - width - 1) & value) != 0) { return RubyBignum.newBignum(getRuntime(), value).op_lshift(RubyFixnum.newFixnum(getRuntime(), width)); } return RubyFixnum.newFixnum(getRuntime(), value << width); }
private IRubyObject lshift(long width) { if (width > BIT_SIZE - 1 || ((~0L << BIT_SIZE - width - 1) & value) != 0) { return RubyBignum.newBignum(getRuntime(), value).op_lshift(RubyFixnum.newFixnum(getRuntime(), width)); } return RubyFixnum.newFixnum(getRuntime(), value << width); }