lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: [VOTE] release 3.3
Date Fri, 24 Jun 2011 16:32:36 GMT
Yonik,

You are the best. If you look at the test, its also broken somehow, because
it uses length vs. size() wrong (I already reopened the
https://issues.apache.org/jira/browse/LUCENE-3179 issue).

And please stop ranting about Java 5, it helped to find a bug in this impl,
its really broken as OpenBitSet always allows indexes >= size (except fast*
methods).

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: yseeley@gmail.com [mailto:yseeley@gmail.com] On Behalf Of Yonik
> Seeley
> Sent: Friday, June 24, 2011 6:29 PM
> To: dev@lucene.apache.org
> Subject: Re: [VOTE] release 3.3
> 
> On Fri, Jun 24, 2011 at 12:14 PM, Yonik Seeley
<yonik@lucidimagination.com>
> wrote:
> > All that needs to be done is to move the negative index check to the
> > bottom (the first index<0 is not needed since we do a signed shift).
> >
> >  public int prevSetBit(int index) {
> >    int i = index>>6;
> >    if (i >= wlen) {
> >      i = wlen - 1;
> >    }
> >    if (i < 0) return -1;
> >    final int subIndex = index & 0x3f;      // index within the word
> >    long word = (bits[i] << (63-subIndex));  // skip all the bits to
> > the left of index
> 
> And a further minor optimization, if we assume that negative indexes are
not
> legal, is to move the (i<0) check inside the if (i>=wlen) block (and just
let a
> negative index passed by the user to cause a natural AIOOB).
> 
> -Yonik
> http://www.lucidimagination.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
> commands, e-mail: dev-help@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message