[ 
https://issues.apache.org/jira/browse/LUCENE-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060722#comment-13060722
 ] 

Robert Ragno commented on LUCENE-3281:
--------------------------------------

Well, size() and capacity() are currently the same. But all that is needed is 
actually:

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

That will have the same effect. You throw away the first value for cap in the 
above, after all. Checking for numButs to be non-negative should be done in the 
constructor, if added, and maybe with a documented exception instead of an 
assert.

> OpenBitSet should report the configured capacity/size
> -----------------------------------------------------
>
>                 Key: LUCENE-3281
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3281
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/other
>    Affects Versions: 3.0, 3.0.1, 3.0.2, 3.0.3, 3.1, 3.2
>            Reporter: Robert Ragno
>            Priority: Minor
>   Original Estimate: 2m
>  Remaining Estimate: 2m
>
> OpenBitSet rounds up the capacity() to the next multiple of 64 from what was 
> specified. However, this is particularly damaging with the new asserts, which 
> trigger when anything above the specified capacity is used as an index. The 
> simple fix is to return numBits for capacity().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to