diff options
author | Heiko Lewin <hlewin@gmx.de> | 2022-11-03 19:13:41 +0000 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2022-11-03 19:13:41 +0000 |
commit | 713077d0a3c310ca1955bc331d46d55d0ae4a72b (patch) | |
tree | 7ff5b47720b8d0bfa554a02c8a290f3f2ea813a9 /pixman/pixman-bits-image.c | |
parent | 618e3d4283b63deeb60e37c049189d4261ddea39 (diff) | |
download | pixman-713077d0a3c310ca1955bc331d46d55d0ae4a72b.tar.gz |
Fix signed-unsigned semantics in reduce_32
Diffstat (limited to 'pixman/pixman-bits-image.c')
-rw-r--r-- | pixman/pixman-bits-image.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index f050f35..6f65420 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -209,15 +209,15 @@ static force_inline void reduce_32(unsigned int satot, unsigned int srtot, { uint32_t *ret = p; - satot = (satot + 0x8000) >> 16; - srtot = (srtot + 0x8000) >> 16; - sgtot = (sgtot + 0x8000) >> 16; - sbtot = (sbtot + 0x8000) >> 16; + satot = (int32_t)(satot + 0x8000) / 65536; + srtot = (int32_t)(srtot + 0x8000) / 65536; + sgtot = (int32_t)(sgtot + 0x8000) / 65536; + sbtot = (int32_t)(sbtot + 0x8000) / 65536; - satot = CLIP (satot, 0, 0xff); - srtot = CLIP (srtot, 0, 0xff); - sgtot = CLIP (sgtot, 0, 0xff); - sbtot = CLIP (sbtot, 0, 0xff); + satot = CLIP ((int32_t)satot, 0, 0xff); + srtot = CLIP ((int32_t)srtot, 0, 0xff); + sgtot = CLIP ((int32_t)sgtot, 0, 0xff); + sbtot = CLIP ((int32_t)sbtot, 0, 0xff); *ret = ((satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot)); } @@ -240,10 +240,10 @@ static force_inline void reduce_float(unsigned int satot, unsigned int srtot, { argb_t *ret = p; - ret->a = CLIP (satot / 65536.f, 0.f, 1.f); - ret->r = CLIP (srtot / 65536.f, 0.f, 1.f); - ret->g = CLIP (sgtot / 65536.f, 0.f, 1.f); - ret->b = CLIP (sbtot / 65536.f, 0.f, 1.f); + ret->a = CLIP ((int32_t)satot / 65536.f, 0.f, 1.f); + ret->r = CLIP ((int32_t)srtot / 65536.f, 0.f, 1.f); + ret->g = CLIP ((int32_t)sgtot / 65536.f, 0.f, 1.f); + ret->b = CLIP ((int32_t)sbtot / 65536.f, 0.f, 1.f); } typedef void (* accumulate_pixel_t) (unsigned int *satot, unsigned int *srtot, |