Skip to content

Commit ab29192

Browse files
committed
fix: simd binary ip for 32bit
Signed-off-by: Keming <[email protected]>
1 parent 1007380 commit ab29192

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/simd.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ pub unsafe fn binary_dot_product(lhs: &[u64], rhs: &[u64]) -> u32 {
377377
_mm256_castsi256_si128(sum256),
378378
_mm256_extracti128_si256(sum256, 1),
379379
);
380-
sum += _mm_cvtsi128_si64(_mm_add_epi64(xa, _mm_shuffle_epi32(xa, 78))) as u32;
380+
// this assumes the length is less than 2 ** 31
381+
sum += _mm_cvtsi128_si32(_mm_add_epi64(xa, _mm_shuffle_epi32(xa, 78))) as u32;
381382

382383
sum
383384
}

0 commit comments

Comments
 (0)