as for  1. , I am stupid, i did not read it correctly and I gave wrong example !
example should read...

x = new OpenBitSet(1024);
x. set(22);
x.capacity() should return 23, but it returnes 1024

and this is exactly what is written in javadoc for this method, so forget it.

what I was reading was: "(1 greater than the index of the last *set* bit)" like 
standard BitSet.length();




----- Original Message ----
From: eks dev <[EMAIL PROTECTED]>
To: solr-dev@lucene.apache.org
Sent: Saturday, 12 August, 2006 7:53:27 PM
Subject: Re: OpenBitSet.equals(Object o) bug?

When we are allready in the office :)

1. Is this javadoc correct and what are invariants for this to be true? 
Actually, I think it is not and I have no idea how I would make it do this 
efficiently.

  /** Returns the current capacity in bits (1 greater than the index of the 
last bit) */
  public long capacity() { return bits.length << 6; }

in this case:
x = new OpenBitSet(1024);
x. set(22);
x.capacity() should return 23, but it returnes 22

right?

The question really is how to implement lastSetBit(long )

2. nextClearBit(int/long index). Any ideas how to do it efficiantly?

I will try to add set(long from, long to) and clear(long from, long to) as 
there is a nice flip(long, long) method as a template (any hints there?). For 
previous 2 questions, bit twidlling is not my world, especially in this 
turbo_save_every_cpu_tick you made :) That is why I bother you


----- Original Message ----
From: Yonik Seeley <[EMAIL PROTECTED]>
To: solr-dev@lucene.apache.org
Sent: Saturday, 12 August, 2006 7:25:50 PM
Subject: Re: OpenBitSet.equals(Object o) bug?

Right you are, Thanks!

-Yonik

On 8/12/06, eks dev <[EMAIL PROTECTED]> wrote:
>
> Yonik, should this not be the other way round, or I missed something? "this" 
> is always an instance of OpenBitSet
>
>     if (!(o instanceof OpenBitSet)) return false;
> instead of:
>
>   public boolean equals(Object o) {
> ...
>     if (!(this instanceof OpenBitSet)) return false;
> ...






Reply via email to