lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <yo...@lucidimagination.com>
Subject Re: [VOTE] release 3.3
Date Fri, 24 Jun 2011 18:02:43 GMT
On Fri, Jun 24, 2011 at 1:35 PM, Uwe Schindler <uwe@thetaphi.de> wrote:
> Hi Yonik, I wrote atestcase that checks how prevSetBit behaves, if I add you
> patch with optimization. It still had a bug, if the index is beyond last
> word but not at a multiple of bitsPerWord.

Ahh, right, good catch! You want to start at the last bit rather than
calculate the bit via MOD in that case.

> Your additional optimization with negative indexes is invalid,

Well, invalid if negative indexes are valid.

> because on
> negative indexes prevSetBit() must be negative. If we don’t do this, a
> typical loop like would AIOOBE:
>
> for (int i = bs.prevSetBit(0); i >= 0; i = bs.prevSetBit(i-1)) {
>     // operate on index i here
>  }

Yep, that makes sense to allow.

-Yonik
http://www.lucidimagination.com

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


Mime
View raw message