Skip to content

Commit

Permalink
Revert return value change and just construct fixnum directly.
Browse files Browse the repository at this point in the history
Fixes #5216.
  • Loading branch information
headius committed Jun 12, 2018
1 parent 8903315 commit a8435d1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyNumeric.java
Expand Up @@ -330,7 +330,7 @@ public static RubyInteger str2inum(Ruby runtime, RubyString str, int base) {
return str2inum(runtime, str, base, false);
}

public static RubyInteger int2fix(Ruby runtime, long val) {
public static RubyNumeric int2fix(Ruby runtime, long val) {
return RubyFixnum.newFixnum(runtime, val);
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyRandom.java
Expand Up @@ -652,7 +652,7 @@ public static IRubyObject left(ThreadContext context, IRubyObject recv) {
@JRubyMethod(name = "marshal_dump")
public IRubyObject marshal_dump(ThreadContext context) {
RubyBignum state = random.getState();
RubyInteger left = RubyNumeric.int2fix(context.runtime, random.getLeft());
RubyInteger left = RubyFixnum.newFixnum(context.runtime, (long) random.getLeft());
RubyArray dump = RubyArray.newArray(context.runtime, state, left, random.getSeed());
if (hasVariables()) {
dump.syncVariables(this);
Expand Down
Expand Up @@ -1827,7 +1827,7 @@ public IRubyObject to_int(ThreadContext context) {
final RubyInteger to_int(Ruby runtime) {
checkFloatDomain();
try {
return RubyNumeric.int2fix(runtime, value.longValueExact());
return RubyFixnum.newFixnum(runtime, value.longValueExact());
} catch (ArithmeticException ex) {
return RubyBignum.bignorm(runtime, value.toBigInteger());
}
Expand Down

0 comments on commit a8435d1

Please sign in to comment.