refactor(bitflags): Simplify functions in BitFlags class#2472
Open
xezon wants to merge 5 commits intoTheSuperHackers:mainfrom
Open
refactor(bitflags): Simplify functions in BitFlags class#2472xezon wants to merge 5 commits intoTheSuperHackers:mainfrom
xezon wants to merge 5 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Include/Common/BitFlags.h | All refactored operations are logically equivalent to the originals. The intentional removal of DEBUG_ASSERTCRASH from testForAll weakens debug-time detection of zero-flag arguments on direct testForAll call sites (beyond testSetAndClear), but is necessary for the testSetAndClear delegation to work correctly. |
| GeneralsMD/Code/GameEngine/Include/Common/BitFlags.h | Identical changes mirrored from the Generals copy. Same analysis applies — logic is correct and the assertion removal is intentional. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
TSC["testSetAndClear(mustBeSet, mustBeClear)"]
TFN["testForNone(mustBeClear)\n(m_bits & that.m_bits).none()"]
TFA["testForAll(mustBeSet)\n(m_bits & that.m_bits) == that.m_bits"]
RET_FALSE["return false"]
RET_TRUE["return true"]
TSC -->|"short-circuit &&"| TFN
TFN -->|"false"| RET_FALSE
TFN -->|"true"| TFA
TFA -->|"false"| RET_FALSE
TFA -->|"true"| RET_TRUE
Last reviewed commit: "Remove the assert"
Mauller
approved these changes
Mar 18, 2026
Mauller
left a comment
There was a problem hiding this comment.
Looks okay to me, was slightly confused by some at first when they were saying All must be set.
xezon
commented
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change simplifies the function implementations in the BitFlags class.
If I did not make a mistake it should behave exactly the same.
TODO