Fixes for undefined behaviour on signed shift (#3453)
Fixes for undefined behaviour on signed shift Change literal 1 to unsigned to allow safe bitshift of 31. Caught by cppcheck. Make 0xFF unsigned to prevent a left shift into signed bit. Spotted by @orestisf1993
This commit is contained in:
@ -43,7 +43,7 @@ uint32_t get_colorpixel(const char *hex) {
|
||||
|
||||
/* Shortcut: if our screen is true color, no need to do a roundtrip to X11 */
|
||||
if (root_screen == NULL || root_screen->root_depth == 24 || root_screen->root_depth == 32) {
|
||||
return (0xFF << 24) | (r << 16 | g << 8 | b);
|
||||
return (0xFFUL << 24) | (r << 16 | g << 8 | b);
|
||||
}
|
||||
|
||||
/* Lookup this colorpixel in the cache */
|
||||
|
Reference in New Issue
Block a user