FIX: left shift of 1 by 31 places cannot be represented in type 'int' (#198)

This commit is contained in:
furudbat 2022-05-06 11:51:02 +02:00 committed by GitHub
parent f13c5c3ec3
commit c991cbcaf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3647,7 +3647,7 @@ char **GuiLoadIcons(const char *fileName, bool loadIconsName)
// Draw selected icon using rectangles pixel-by-pixel // Draw selected icon using rectangles pixel-by-pixel
void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color) void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color)
{ {
#define BIT_CHECK(a,b) ((a) & (1<<(b))) #define BIT_CHECK(a,b) ((a) & (1u<<(b)))
for (int i = 0, y = 0; i < RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32; i++) for (int i = 0, y = 0; i < RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32; i++)
{ {
@ -3693,7 +3693,7 @@ void GuiSetIconScale(unsigned int scale)
// Set icon pixel value // Set icon pixel value
void GuiSetIconPixel(int iconId, int x, int y) void GuiSetIconPixel(int iconId, int x, int y)
{ {
#define BIT_SET(a,b) ((a) |= (1<<(b))) #define BIT_SET(a,b) ((a) |= (1u<<(b)))
// This logic works for any RAYGUI_ICON_SIZE pixels icons, // This logic works for any RAYGUI_ICON_SIZE pixels icons,
// For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element // For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
@ -3703,7 +3703,7 @@ void GuiSetIconPixel(int iconId, int x, int y)
// Clear icon pixel value // Clear icon pixel value
void GuiClearIconPixel(int iconId, int x, int y) void GuiClearIconPixel(int iconId, int x, int y)
{ {
#define BIT_CLEAR(a,b) ((a) &= ~((1)<<(b))) #define BIT_CLEAR(a,b) ((a) &= ~((1u)<<(b)))
// This logic works for any RAYGUI_ICON_SIZE pixels icons, // This logic works for any RAYGUI_ICON_SIZE pixels icons,
// For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element // For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
@ -3713,7 +3713,7 @@ void GuiClearIconPixel(int iconId, int x, int y)
// Check icon pixel value // Check icon pixel value
bool GuiCheckIconPixel(int iconId, int x, int y) bool GuiCheckIconPixel(int iconId, int x, int y)
{ {
#define BIT_CHECK(a,b) ((a) & (1<<(b))) #define BIT_CHECK(a,b) ((a) & (1u<<(b)))
return (BIT_CHECK(guiIcons[iconId*8 + y/2], x + (y%2*16))); return (BIT_CHECK(guiIcons[iconId*8 + y/2], x + (y%2*16)));
} }