Skip to content

Commit

Permalink
[rtextures] Fix Undefined behaviour in ColorToInt (#3996)
Browse files Browse the repository at this point in the history
  • Loading branch information
OetkenPurveyorOfCode authored May 21, 2024
1 parent c4a51a3 commit 9ef29af
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/rtextures.c
Original file line number Diff line number Diff line change
Expand Up @@ -4510,9 +4510,7 @@ Color Fade(Color color, float alpha)
// Get hexadecimal value for a Color
int ColorToInt(Color color)
{
int result = (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a);

return result;
return (int)(((unsigned)color.r << 24) | ((unsigned)color.g << 16) | ((unsigned)color.b << 8) | color.a);
}

// Get color normalized as float [0..1]
Expand Down

0 comments on commit 9ef29af

Please sign in to comment.