fix OpenBitSet.flip(start,end)

git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@431284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2006-08-14 02:39:23 +00:00
parent ed7ab7baec
commit 0a69bbbcff
2 changed files with 6 additions and 1 deletions

View File

@ -368,7 +368,7 @@ public class OpenBitSet implements Cloneable, Serializable {
***/
long startmask = -1L << startIndex;
long endmask = (endIndex&0x3c)==0 ? 0 : -1L >>> (64-endIndex);
long endmask = (endIndex&0x3f)==0 ? 0 : -1L >>> (64-endIndex);
if (this.wlen <= endWord) {
this.wlen = endWord;

View File

@ -64,6 +64,11 @@ public class TestOpenBitSet extends TestCase {
idx = rand.nextInt(sz);
a.flip(idx);
b.fastFlip(idx);
int idx1 = rand.nextInt(sz);
int idx2 = rand.nextInt(sz);
if (idx1>idx2) { idx=idx1; idx1=idx2; idx2=idx; }
a.flip(idx1,idx2);
b.flip(idx1,idx2);
boolean val = b.flipAndGet(idx);
boolean val2 = b.flipAndGet(idx);