Skip to content

Commit

Permalink
fix the issue of memory misalignment during the HNSW assignment proce…
Browse files Browse the repository at this point in the history
…ss (#263)

Signed-off-by: jinjiabao.jjb <[email protected]>
Co-authored-by: jinjiabao.jjb <[email protected]>
  • Loading branch information
inabao and jinjiabao.jjb authored Dec 26, 2024
1 parent 94f1b02 commit b579572
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/algorithm/hnswlib/hnswalg.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ class HierarchicalNSW : public AlgorithmInterface<float> {

inline void
setExternalLabel(InnerIdType internal_id, LabelType label) const {
*(LabelType*)(data_level0_memory_->GetElementPtr(internal_id, label_offset_)) = label;
std::memcpy(data_level0_memory_->GetElementPtr(internal_id, label_offset_),
&label,
sizeof(LabelType));
}

inline LabelType*
Expand Down

0 comments on commit b579572

Please sign in to comment.