xbm/parse: use uint32 instead of int for << 24

This commit is contained in:
Johan Malm 2020-08-12 19:42:59 +01:00
parent 2a17df0f8b
commit fc2754ac89

View file

@ -19,12 +19,11 @@ static unsigned char defaultcolor[] = { 255, 255, 255, 255 };
static uint32_t u32(unsigned char *rgba) static uint32_t u32(unsigned char *rgba)
{ {
uint32_t ret = 0; uint32_t r[4] = { 0 };
ret |= (rgba[3] & 0xff) << 24; for (int i = 0; i < 4; i++)
ret |= (rgba[2] & 0xff) << 16; r[i] = rgba[i];
ret |= (rgba[1] & 0xff) << 8; return ((r[3] & 0xff) << 24) | ((r[2] & 0xff) << 16) |
ret |= (rgba[0] & 0xff); ((r[1] & 0xff) << 8) | (r[0] & 0xff);
return ret;
} }
static void process_bytes(struct pixmap *pixmap, struct token *tokens) static void process_bytes(struct pixmap *pixmap, struct token *tokens)