Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c0a8a733c9ac
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b7ddabbb51d2
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Apr 20, 2015

  1. Copy the full SHA
    d061cbc View commit details
  2. Merge pull request #2848 from bjfish/truffle_long_specializations

    [Truffle] Adding additional long handling for multiple specializations.
    chrisseaton committed Apr 20, 2015
    Copy the full SHA
    b7ddabb View commit details
Showing with 21 additions and 0 deletions.
  1. +21 −0 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java
Original file line number Diff line number Diff line change
@@ -265,6 +265,27 @@ public Object stringByteSubstring(RubyString string, double index, UndefinedPlac
return stringByteSubstring(string, (int) index, 1);
}

@Specialization
public Object stringByteSubstring(RubyString string, long index, int length) {
return stringByteSubstring(string, index, (long) length);
}

@Specialization
public Object stringByteSubstring(RubyString string, int index, long length) {
return stringByteSubstring(string, (long) index, length);
}

@Specialization
public Object stringByteSubstring(RubyString string, long index, long length) {
if (index > Integer.MAX_VALUE || index < Integer.MIN_VALUE) {
throw new RaiseException(getContext().getCoreLibrary().argumentError("index out of int range", this));
}
if (length > Integer.MAX_VALUE || length < Integer.MIN_VALUE) {
throw new RaiseException(getContext().getCoreLibrary().argumentError("length out of int range", this));
}
return stringByteSubstring(string, (int) index, (int) length);
}

@Specialization
public Object stringByteSubstring(RubyString string, double index, double length) {
return stringByteSubstring(string, (int) index, (int) length);