Skip to content

left shift on unsigned#2821

Merged
salix5 merged 1 commit into
Fluorohydride:masterfrom
salix5:patch-shift
Jun 1, 2025
Merged

left shift on unsigned#2821
salix5 merged 1 commit into
Fluorohydride:masterfrom
salix5:patch-shift

Conversation

@salix5

@salix5 salix5 commented Jun 1, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@salix5 salix5 requested a review from Copilot June 1, 2025 12:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 filter represents a bit index rather than a mask; consider renaming it (e.g., bitIndex or attributeIndex) to clarify its purpose.
for (int filter = 0; filter < ATTRIBUTES_COUNT; ++filter)

gframe/game.cpp:746

  • [nitpick] The loop variable filter again serves as a bit position; rename it (e.g., bitIndex or raceIndex) to improve readability.
for (int filter = 0; filter < RACES_COUNT; ++filter)

gframe/event_handler.cpp:1308

  • [nitpick] The variable flag is ambiguous in this context; consider renaming it to mask or fieldMask to convey that it represents a bit mask.
unsigned int flag = 0x1U << (hovered_sequence + (hovered_controler << 4) + ((hovered_location == LOCATION_MZONE) ? 0 : 8));

Comment thread gframe/replay.cpp
@salix5 salix5 merged commit c41aa28 into Fluorohydride:master Jun 1, 2025
8 checks passed
@salix5 salix5 deleted the patch-shift branch June 1, 2025 12:32
@salix5 salix5 changed the title left shit on unsigned left shift on unsigned Jun 8, 2025
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