From 2a9bdc00981621c21e95e2bac474e64384efacd2 Mon Sep 17 00:00:00 2001 From: aherbert Date: Thu, 12 Mar 2020 13:59:19 +0000 Subject: [PATCH] Improve comment in BloomFilterIndexer. --- .../commons/collections4/bloomfilter/BloomFilterIndexer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexer.java b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexer.java index 9bed48b45..22044fbd3 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexer.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilterIndexer.java @@ -53,7 +53,9 @@ final class BloomFilterIndexer { * @see #checkPositive(int) */ static int getLongIndex(int bitIndex) { - // Use a signed shift. Any negative index will produce a negative value + // An integer divide by 64 is equivalent to a shift of 6 bits if the integer is positive. + // We do not explicitly check for a negative here. Instead we use a + // a signed shift. Any negative index will produce a negative value // by sign-extension and if used as an index into an array it will throw an exception. return bitIndex >> DIVIDE_BY_64; }