Skip to content

Commit e23f6ca

Browse files
committed
Fix compilation
1 parent 5de0c43 commit e23f6ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hnswlib/hnswlib.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,9 @@ class ChunkedArray {
439439
char* operator[](size_t i) const {
440440
assert(i < getCapacity());
441441
if (i >= getCapacity()) return nullptr;
442-
return getElementNoRangeChecking(i);
442+
size_t chunk_index = i / elements_per_chunk_;
443+
size_t index_in_chunk = i % elements_per_chunk_;
444+
return chunks_[chunk_index].get() + element_byte_size_ * index_in_chunk;
443445
}
444446

445447
void clear() {

0 commit comments

Comments
 (0)