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

Allow to remove an enum bit (case) twice #32

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

gisostallenberg
Copy link
Contributor

No description provided.

@gisostallenberg
Copy link
Contributor Author

Removing an enum case twice currently actually adds the bit

@yaroslavche
Copy link
Owner

yaroslavche commented Jun 13, 2024

If I understand correctly, these should be some strict methods for adding/removing bits that throw exceptions if the bit is not set when removed and if it is set when added. However, in this particular case, we are not interested in whether the bit is set when removing. If it is set, it will be deleted, if not, it will not. In general, it seems to me that there is no change in the behavior of deletion, only the semantics have changed. Need some time, I will review this change in a few days.

I see the test results, you're right. I need to check if BitMask also has this problem, I will do that.

UPD. This problem exists also in BitMask. That fix must be in BitMask. But actually not foreach, but a check if bit is set before perform bitwise operation. Will do that.

yaroslavche added a commit that referenced this pull request Jun 13, 2024
@yaroslavche yaroslavche merged commit bcc6eab into yaroslavche:main Jun 13, 2024
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