lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eks dev <>
Subject Re: OpenBitSet.equals(Object o) bug?
Date Sat, 12 Aug 2006 17:53:27 GMT
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


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

----- Original Message ----
From: Yonik Seeley <>
Sent: Saturday, 12 August, 2006 7:25:50 PM
Subject: Re: OpenBitSet.equals(Object o) bug?

Right you are, Thanks!


On 8/12/06, eks dev <> 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;
> ...

View raw message