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

Fix formatting of multi-bit flags with partial overlap #316

Merged
merged 2 commits into from Mar 16, 2023

Conversation

KodrAus
Copy link
Member

@KodrAus KodrAus commented Mar 16, 2023

Fixes #315

cc @mxk

I've added a repro for the bug reported here: #310 (comment)

It looks like we'll need to tweak the iter_names method to make sure we include any remaining bits when they overlap, but don't complete, a multi-bit flag.

@KodrAus
Copy link
Member Author

KodrAus commented Mar 16, 2023

Ok, it looks like the fix for this was fairly straightfoward: we were using the flags themselves to try mask out any bits that don't correspond to a valid flag, but in this example the extra bits do correspond to part of a flag. So we'd mask them out without printing anything for them.

Using the iterator as the source of these bits ensures anything not printed by name will get printed as a hex number.

@KodrAus KodrAus merged commit af44dcc into bitflags:main Mar 16, 2023
15 checks passed
@KodrAus KodrAus deleted the fix/multi-bit-flag-fmt branch March 16, 2023 03:30
@mxk
Copy link

mxk commented Mar 16, 2023

Thanks for getting this fixed!

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.

Display missing extra bits for multi-bit flags
2 participants