Skip to content

Commit

Permalink
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -3291,17 +3291,17 @@ final IRubyObject uptoCommon(ThreadContext context, IRubyObject arg, boolean exc
RubyArray argsArr = RubyArray.newArray(runtime, RubyFixnum.newFixnum(runtime, value.length()), context.nil);

if (b instanceof RubyFixnum && e instanceof RubyFixnum) {
int bi = RubyNumeric.fix2int(b);
int ei = RubyNumeric.fix2int(e);
long bl = RubyNumeric.fix2long(b);
long el = RubyNumeric.fix2long(e);

while (bi <= ei) {
if (excl && bi == ei) break;
argsArr.eltSetOk(1, RubyFixnum.newFixnum(runtime, bi));
while (bl <= el) {
if (excl && bl == el) break;
argsArr.eltSetOk(1, RubyFixnum.newFixnum(runtime, bl));
ByteList to = new ByteList(value.length() + 5);
Sprintf.sprintf(to, "%.*d", argsArr);
RubyString str = RubyString.newStringNoCopy(runtime, to, USASCIIEncoding.INSTANCE, CR_7BIT);
block.yield(context, asSymbol ? runtime.newSymbol(str.toString()) : str);
bi++;
bl++;
}
} else {
StringSites sites = sites(context);

0 comments on commit 4cb79c1

Please sign in to comment.