public IRubyObject op_plus_two(ThreadContext context) { long result = value + 2; //- if (result == Long.MIN_VALUE + 1) { //-code if (result < value) { //+code+patch; maybe use if (result <= value) { return addAsBignum(context, 2); } return newFixnum(context.runtime, result); }
public IRubyObject op_plus_one(ThreadContext context) { long result = value + 1; if (result == Long.MIN_VALUE) { return addAsBignum(context, 1); } return newFixnum(context.runtime, result); }
public IRubyObject op_plus_one(ThreadContext context) { long result = value + 1; if (result == Long.MIN_VALUE) { return addAsBignum(context, 1); } return newFixnum(context.runtime, result); }
public IRubyObject op_plus_two(ThreadContext context) { long result = value + 2; //- if (result == Long.MIN_VALUE + 1) { //-code if (result < value) { //+code+patch; maybe use if (result <= value) { return addAsBignum(context, 2); } return newFixnum(context.runtime, result); }
public IRubyObject op_plus_two(ThreadContext context) { long result = value + 2; //- if (result == Long.MIN_VALUE + 1) { //-code if (result < value) { //+code+patch; maybe use if (result <= value) { return addAsBignum(context, 2); } return newFixnum(context.runtime, result); }
public IRubyObject op_plus_two(ThreadContext context) { long result = value + 2; //- if (result == Long.MIN_VALUE + 1) { //-code if (result < value) { //+code+patch; maybe use if (result <= value) { return addAsBignum(context, 2); } return newFixnum(context.runtime, result); }
private RubyInteger addFixnum(ThreadContext context, RubyFixnum other) { try { return newFixnum(context.runtime, Math.addExact(value, other.value)); } catch (ArithmeticException ae) { return addAsBignum(context, other.value); } }
@Override public IRubyObject op_plus(ThreadContext context, long otherValue) { try { return newFixnum(context.runtime, Math.addExact(value, otherValue)); } catch (ArithmeticException ae) { return addAsBignum(context, otherValue); } }
private IRubyObject addFixnum(ThreadContext context, RubyFixnum other) { long otherValue = other.value; long result = value + otherValue; if (additionOverflowed(value, otherValue, result)) { return addAsBignum(context, other); } return newFixnum(context.runtime, result); }
public IRubyObject op_plus_one(ThreadContext context) { try { return newFixnum(context.runtime, Math.addExact(value, 1)); } catch (ArithmeticException ae) { return addAsBignum(context, 1); } }
private RubyInteger addFixnum(ThreadContext context, RubyFixnum other) { try { return newFixnum(context.runtime, Math.addExact(value, other.value)); } catch (ArithmeticException ae) { return addAsBignum(context, other.value); } }
@Override public IRubyObject op_plus(ThreadContext context, long otherValue) { try { return newFixnum(context.runtime, Math.addExact(value, otherValue)); } catch (ArithmeticException ae) { return addAsBignum(context, otherValue); } }
public IRubyObject op_plus_one(ThreadContext context) { try { return newFixnum(context.runtime, Math.addExact(value, 1)); } catch (ArithmeticException ae) { return addAsBignum(context, 1); } }
public IRubyObject op_plus(ThreadContext context, long otherValue) { long result = value + otherValue; if (additionOverflowed(value, otherValue, result)) { return addAsBignum(context, otherValue); } return newFixnum(context.runtime, result); }
public IRubyObject op_plus(ThreadContext context, long otherValue) { long result = value + otherValue; if (additionOverflowed(value, otherValue, result)) { return addAsBignum(context, otherValue); } return newFixnum(context.runtime, result); }
private IRubyObject addFixnum(ThreadContext context, RubyFixnum other) { long otherValue = other.value; long result = value + otherValue; if (additionOverflowed(value, otherValue, result)) { return addAsBignum(context, other); } return newFixnum(context.runtime, result); }