summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2018-01-09 10:26:29 +0100
committerBehdad Esfahbod <behdad@behdad.org>2018-01-09 10:26:29 +0100
commit8b95e0e460baa499e54c19d29bf761d34c25badc (patch)
tree3ac318600758dfc9fe39dfcbb74eca79ef53356e
parent85467ec308f8621a5410c007491797b7b1847601 (diff)
downloadpixman-8b95e0e460baa499e54c19d29bf761d34c25badc.tar.gz
pixman-8b95e0e460baa499e54c19d29bf761d34c25badc.tar.bz2
pixman-8b95e0e460baa499e54c19d29bf761d34c25badc.zip
Promote unsigned short to unsigned int explicitly
...to avoid default promotion to signed int, which causes undefined behaviour in the shift expression.
-rw-r--r--pixman/pixman-solid-fill.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c
index 5f9fef6..4694ebc 100644
--- a/pixman/pixman-solid-fill.c
+++ b/pixman/pixman-solid-fill.c
@@ -30,10 +30,10 @@ static uint32_t
color_to_uint32 (const pixman_color_t *color)
{
return
- (color->alpha >> 8 << 24) |
- (color->red >> 8 << 16) |
- (color->green & 0xff00) |
- (color->blue >> 8);
+ ((unsigned int) color->alpha >> 8 << 24) |
+ ((unsigned int) color->red >> 8 << 16) |
+ ((unsigned int) color->green & 0xff00) |
+ ((unsigned int) color->blue >> 8);
}
static argb_t