Skip to content

Commit

Permalink
Fix operator precedence in DDSFileClass::Merge_Color (#1141)
Browse files Browse the repository at this point in the history
  • Loading branch information
xezon authored Aug 11, 2024
1 parent fa47389 commit b7a373a
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit b7a373a

Please sign in to comment.