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 operator precedence in DDSFileClass::Merge_Color #1141

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/w3d/renderer/ddsfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ inline uint32_t DDSFileClass::Merge_Color(uint32_t color_a, uint32_t color_b, ui
const uint32_t G_MASK = 0x0000FF00;
const uint32_t R_B_MASK = 0x00FF00FF;

return ((color_a_amount * (color_a & G_MASK)) + (color_b_amount * (color_b & G_MASK)) >> 8) & G_MASK
| ((color_a_amount * (color_a & R_B_MASK)) + (color_b_amount * (color_b & R_B_MASK)) >> 8) & R_B_MASK;
return (((color_a_amount * (color_a & G_MASK)) + (color_b_amount * (color_b & G_MASK))) >> 8) & G_MASK
| (((color_a_amount * (color_a & R_B_MASK)) + (color_b_amount * (color_b & R_B_MASK))) >> 8) & R_B_MASK;
}

inline uint32_t DDSFileClass::Decode_Line_Code(uint8_t *packed)
Expand Down
Loading