Thanks Dawid! Mike McCandless
http://blog.mikemccandless.com On Fri, Aug 17, 2012 at 4:46 PM, <dwe...@apache.org> wrote: > Author: dweiss > Date: Fri Aug 17 20:46:16 2012 > New Revision: 1374431 > > URL: http://svn.apache.org/viewvc?rev=1374431&view=rev > Log: > Rewrite the copying loop slightly; scratch.grow has an assert offset == 0 > so moved this reset up before grow. > > Modified: > lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java > > Modified: > lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java > URL: > http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java?rev=1374431&r1=1374430&r2=1374431&view=diff > ============================================================================== > --- > lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java > (original) > +++ > lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java > Fri Aug 17 20:46:16 2012 > @@ -771,16 +771,14 @@ public final class Util { > * IntsRef. */ > public static IntsRef toUTF16(CharSequence s, IntsRef scratch) { > final int charLimit = s.length(); > + scratch.offset = 0; > + scratch.length = charLimit; > scratch.grow(charLimit); > - int idx = 0; > - while(idx < charLimit) { > + for (int idx = 0; idx < charLimit; idx++) { > scratch.ints[idx] = (int) s.charAt(idx); > - idx++; > } > - scratch.offset = 0; > - scratch.length = idx; > return scratch; > - } > + } > > /** Decodes the Unicode codepoints from the provided > * CharSequence and places them in the provided scratch > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org