mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 11:28:17 +00:00
[rtextures] Fix Undefined behaviour in ColorToInt (#3996)
This commit is contained in:

committed by
GitHub

parent
c4a51a3ebd
commit
9ef29aff9a
@@ -4510,9 +4510,7 @@ Color Fade(Color color, float alpha)
|
|||||||
// Get hexadecimal value for a Color
|
// Get hexadecimal value for a Color
|
||||||
int ColorToInt(Color color)
|
int ColorToInt(Color color)
|
||||||
{
|
{
|
||||||
int result = (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a);
|
return (int)(((unsigned)color.r << 24) | ((unsigned)color.g << 16) | ((unsigned)color.b << 8) | color.a);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get color normalized as float [0..1]
|
// Get color normalized as float [0..1]
|
||||||
|
Reference in New Issue
Block a user