jpountz commented on a change in pull request #980: LUCENE-8920: Reduce the 
memory used by direct addressing of arcs
URL: https://github.com/apache/lucene-solr/pull/980#discussion_r339959800
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/util/fst/FST.java
 ##########
 @@ -864,6 +1012,68 @@ private long readUnpackedNodeTarget(BytesReader in) 
throws IOException {
     return readNextRealArc(arc, in);
   }
 
+  /**
+   * Reads the presence bits of a direct-addressing node, store them in the 
provided arc {@link Arc#bitTable()} and returns the number of presence bytes.
+   */
+  private int readPresenceBytes(Arc<T> arc, BytesReader in) throws IOException 
{
+    int numPresenceBytes = getNumPresenceBytes(arc.numArcs());
+    long[] presenceBits = new long[numPresenceBytes + 7 >>> 3];
+    int longIndex = 0;
+    int byteIndex = 0;
+    for (int i = 0; i < numPresenceBytes; i++) {
+      presenceBits[longIndex] |= (long) (in.readByte() & 0xFF) << (i << 3);
 
 Review comment:
   maybe we should even remove longIndex/byteIndex for clarity and do
   
   ```
   presenceBits[i >>>3] |= (in.readByte() & 0xFFL) << (i << 3);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to