From: Johan Malm Date: Wed, 12 Aug 2020 18:42:59 +0000 (+0100) Subject: xbm/parse: use uint32 instead of int for << 24 X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=fc2754ac89d57ceb84f2dd6db1150f86b7caa2d8;p=proto%2Flabwc.git xbm/parse: use uint32 instead of int for << 24 --- diff --git a/src/theme/xbm/parse.c b/src/theme/xbm/parse.c index a85f0ae4..a171428e 100644 --- a/src/theme/xbm/parse.c +++ b/src/theme/xbm/parse.c @@ -19,12 +19,11 @@ static unsigned char defaultcolor[] = { 255, 255, 255, 255 }; static uint32_t u32(unsigned char *rgba) { - uint32_t ret = 0; - ret |= (rgba[3] & 0xff) << 24; - ret |= (rgba[2] & 0xff) << 16; - ret |= (rgba[1] & 0xff) << 8; - ret |= (rgba[0] & 0xff); - return ret; + uint32_t r[4] = { 0 }; + for (int i = 0; i < 4; i++) + r[i] = rgba[i]; + return ((r[3] & 0xff) << 24) | ((r[2] & 0xff) << 16) | + ((r[1] & 0xff) << 8) | (r[0] & 0xff); } static void process_bytes(struct pixmap *pixmap, struct token *tokens)