lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r740806 - /lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java
Date Wed, 04 Feb 2009 17:34:03 GMT
Author: mikemccand
Date: Wed Feb  4 17:34:02 2009
New Revision: 740806

URL: http://svn.apache.org/viewvc?rev=740806&view=rev
Log:
replace 'if' with 'assert' to eek performance in BitVector.get

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java?rev=740806&r1=740805&r2=740806&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/util/BitVector.java Wed Feb  4 17:34:02 2009
@@ -99,9 +99,7 @@
   /** 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;
   }
 



Mime
View raw message