From 9ef29aff9aa08e64ac2d25048829de7459ee7d25 Mon Sep 17 00:00:00 2001 From: OetkenPurveyorOfCode Date: Tue, 21 May 2024 15:44:02 +0200 Subject: [PATCH] [rtextures] Fix Undefined behaviour in ColorToInt (#3996) --- src/rtextures.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/rtextures.c b/src/rtextures.c index 47ff83f5c..ca4c60d16 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -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]