Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update removePoint in bruteforce.h #382

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update bruteforce.h
- bruteforce.h : removePoint bug fix
  • Loading branch information
bongmo committed Jun 7, 2022
commit f3532c847a13a4e588700ac0e5217b06ca1fea13
3 changes: 2 additions & 1 deletion hnswlib/bruteforce.h
Original file line number Diff line number Diff line change
@@ -78,7 +78,8 @@ namespace hnswlib {
dict_external_to_internal.erase(cur_external);

labeltype label=*((labeltype*)(data_ + size_per_element_ * (cur_element_count-1) + data_size_));
dict_external_to_internal[label]=cur_c;
if (cur_external != label)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess a check for cur_element_count>1 would be easier to read.
Also I think copying of the element in the next lines do not make any sense so should be in the same if

dict_external_to_internal[label]=cur_c;
memcpy(data_ + size_per_element_ * cur_c,
data_ + size_per_element_ * (cur_element_count-1),
data_size_+sizeof(labeltype));