jtibshirani commented on code in PR #11861:
URL: https://github.com/apache/lucene/pull/11861#discussion_r999709822


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene94/Lucene94HnswVectorsReader.java:
##########
@@ -175,7 +175,7 @@ private void validateFieldEntry(FieldInfo info, FieldEntry 
fieldEntry) {
           case BYTE -> Byte.BYTES;
           case FLOAT32 -> Float.BYTES;
         };
-    int numBytes = fieldEntry.size * dimension * byteSize;
+    long numBytes = (long) fieldEntry.size * dimension * byteSize;

Review Comment:
   I realized I don't totally understand this suggestion. We have three `ints` 
and we want to compute the product as a `long`. Are you suggesting something 
like this?
   
   ```
   long numBytes = Math.multiplyExact(Math.multiplyExact((long) 
fieldEntry.size, dimension), byteSize);
   ```



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to