left shift on unsigned#2821
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors bitmask generation and ensures unsigned shifts are used for clarity and correctness, and updates compression parameters in LzmaCompress.
- Use an unsigned shift literal (
0x1U << 24) in the compression call to avoid signed overflow. - Change attribute and race combo‐box loops to iterate by bit index and generate masks.
- Update inline mask calculation in the event handler to use an unsigned shift.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| gframe/replay.cpp | Replaced 1 << 24 with 0x1U << 24 in the LzmaCompress call to enforce an unsigned shift. |
| gframe/game.cpp | Refactored attribute and race combo‐box loops to use an index‐based loop plus 0x1U << index. |
| gframe/event_handler.cpp | Updated inline mask calculation to use an unsigned shift literal (0x1U << ...) for consistency. |
Comments suppressed due to low confidence (3)
gframe/game.cpp:740
- [nitpick] The loop variable
filterrepresents a bit index rather than a mask; consider renaming it (e.g.,bitIndexorattributeIndex) to clarify its purpose.
for (int filter = 0; filter < ATTRIBUTES_COUNT; ++filter)
gframe/game.cpp:746
- [nitpick] The loop variable
filteragain serves as a bit position; rename it (e.g.,bitIndexorraceIndex) to improve readability.
for (int filter = 0; filter < RACES_COUNT; ++filter)
gframe/event_handler.cpp:1308
- [nitpick] The variable
flagis ambiguous in this context; consider renaming it tomaskorfieldMaskto convey that it represents a bit mask.
unsigned int flag = 0x1U << (hovered_sequence + (hovered_controler << 4) + ((hovered_location == LOCATION_MZONE) ? 0 : 8));
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.
No description provided.