replace 'if' with 'assert' to eek performance in BitVector.get

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@740806 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-02-04 17:34:02 +00:00
parent 80b471b0cc
commit 8846fd359e
1 changed files with 1 additions and 3 deletions

View File

@ -99,9 +99,7 @@ public final class BitVector implements Cloneable {
/** Returns <code>true</code> if <code>bit</code> is one and
<code>false</code> if it is zero. */
public final boolean get(int bit) {
if (bit >= size) {
throw new ArrayIndexOutOfBoundsException(bit);
}
assert bit >= 0 && bit < size: "bit " + bit + " is out of bounds 0.." + (size-1);
return (bits[bit >> 3] & (1 << (bit & 7))) != 0;
}