Skip to content

Ghost element when applying multiples minus operations on a PersistentHashSet #219

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

Merged
merged 14 commits into from
May 8, 2025

Conversation

DmitryNekrasov
Copy link
Contributor

@DmitryNekrasov DmitryNekrasov commented May 7, 2025

If after removing elements from one collision there is one element left, it should be promoted up recursively, but because the realBitMap == bitmap check is above the realSize == 1 && shift != 0 check (and the first check always passes if the removal does not happen at this step of the recursion), the promotion only happens 1 level up. I swapped these checks, now everything works correctly. Also, I've added a simpler test that reproduces this issue.

@DmitryNekrasov DmitryNekrasov requested a review from fzhinkin May 7, 2025 11:45
@DmitryNekrasov DmitryNekrasov self-assigned this May 7, 2025
Copy link
Collaborator

@fzhinkin fzhinkin left a comment

Choose a reason for hiding this comment

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

Nicely done!

@DmitryNekrasov DmitryNekrasov merged commit 6b1c71c into master May 8, 2025
1 check passed
@DmitryNekrasov DmitryNekrasov deleted the dmitry.nekrasov/bugfix/144 branch May 8, 2025 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants