Skip to content

Commit 61a86a0

Browse files
committed
Change stripe reference
1 parent cfc7175 commit 61a86a0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/DefaultESVectorUtilSupport.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,20 @@ static float ipFloatBitImpl(float[] q, byte[] d, int start) {
242242
public static long ipByteBinByteImpl(byte[] q, byte[] d) {
243243
long ret = 0;
244244
int size = d.length;
245-
for (int n = 0; n < B_QUERY; n++) { // for each stripe of B_QUERY-bit quantization in q...
245+
for (int s = 0; s < B_QUERY; s++) { // for each stripe of B_QUERY-bit quantization in q...
246246
int r = 0;
247247
long stripeRet = 0;
248248
// bitwise & the query and data vectors together, 32-bits at a time, and counting up the bits still set
249249
for (final int upperBound = d.length & -Integer.BYTES; r < upperBound; r += Integer.BYTES) {
250-
stripeRet += Integer.bitCount((int) BitUtil.VH_NATIVE_INT.get(q, n * size + r) & (int) BitUtil.VH_NATIVE_INT.get(d, r));
250+
stripeRet += Integer.bitCount((int) BitUtil.VH_NATIVE_INT.get(q, s * size + r) & (int) BitUtil.VH_NATIVE_INT.get(d, r));
251251
}
252-
// handle any tail (Java operations on bytes automatically extend to int, so we need to mask back down again)
252+
// handle any tail (Java operations on bytes automatically extend to int, so we need to mask back down again
253+
// in case it sign-extends the int)
253254
for (; r < d.length; r++) {
254-
stripeRet += Integer.bitCount((q[n * size + r] & d[r]) & 0xFF);
255+
stripeRet += Integer.bitCount((q[s * size + r] & d[r]) & 0xFF);
255256
}
256-
// shift the result of the n'th stripe n to the left and add to the result
257-
ret += stripeRet << n;
257+
// shift the result of the s'th stripe s to the left and add to the result
258+
ret += stripeRet << s;
258259
}
259260
return ret;
260261
}

0 commit comments

Comments
 (0)