From b4e09690a782b07bca09d080d2d31348b93bfe0a Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 15 Dec 2023 11:52:18 +1100 Subject: [PATCH] pixconv: fix -Werror=sign-conversion Updates #138 --- .../cgen/base/pixconv-submodule-regular.c | 26 +++++++++---------- release/c/wuffs-unsupported-snapshot.c | 26 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/internal/cgen/base/pixconv-submodule-regular.c b/internal/cgen/base/pixconv-submodule-regular.c index 9e3868852..42f58d338 100644 --- a/internal/cgen/base/pixconv-submodule-regular.c +++ b/internal/cgen/base/pixconv-submodule-regular.c @@ -1036,9 +1036,9 @@ wuffs_private_impl__swizzle_bgr_565__bgr(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t b5 = s[0] >> 3; - uint32_t g6 = s[1] >> 2; - uint32_t r5 = s[2] >> 3; + uint32_t b5 = (uint32_t)(s[0] >> 3); + uint32_t g6 = (uint32_t)(s[1] >> 2); + uint32_t r5 = (uint32_t)(s[2] >> 3); uint32_t rgb_565 = (r5 << 11) | (g6 << 5) | (b5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); @@ -1067,9 +1067,9 @@ wuffs_private_impl__swizzle_bgr_565__bgrx(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t b5 = s[0] >> 3; - uint32_t g6 = s[1] >> 2; - uint32_t r5 = s[2] >> 3; + uint32_t b5 = (uint32_t)(s[0] >> 3); + uint32_t g6 = (uint32_t)(s[1] >> 2); + uint32_t r5 = (uint32_t)(s[2] >> 3); uint32_t rgb_565 = (r5 << 11) | (g6 << 5) | (b5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); @@ -1359,9 +1359,9 @@ wuffs_private_impl__swizzle_bgr_565__rgb(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t r5 = s[0] >> 3; - uint32_t g6 = s[1] >> 2; - uint32_t b5 = s[2] >> 3; + uint32_t r5 = (uint32_t)(s[0] >> 3); + uint32_t g6 = (uint32_t)(s[1] >> 2); + uint32_t b5 = (uint32_t)(s[2] >> 3); uint32_t rgb_565 = (r5 << 11) | (g6 << 5) | (b5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); @@ -1565,8 +1565,8 @@ wuffs_private_impl__swizzle_bgr_565__y(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t y5 = s[0] >> 3; - uint32_t y6 = s[0] >> 2; + uint32_t y5 = (uint32_t)(s[0] >> 3); + uint32_t y6 = (uint32_t)(s[0] >> 2); uint32_t rgb_565 = (y5 << 11) | (y6 << 5) | (y5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); @@ -1595,8 +1595,8 @@ wuffs_private_impl__swizzle_bgr_565__y_16be(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t y5 = s[0] >> 3; - uint32_t y6 = s[0] >> 2; + uint32_t y5 = (uint32_t)(s[0] >> 3); + uint32_t y6 = (uint32_t)(s[0] >> 2); uint32_t rgb_565 = (y5 << 11) | (y6 << 5) | (y5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 667c0e245..b8f36bbd0 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -21588,9 +21588,9 @@ wuffs_private_impl__swizzle_bgr_565__bgr(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t b5 = s[0] >> 3; - uint32_t g6 = s[1] >> 2; - uint32_t r5 = s[2] >> 3; + uint32_t b5 = (uint32_t)(s[0] >> 3); + uint32_t g6 = (uint32_t)(s[1] >> 2); + uint32_t r5 = (uint32_t)(s[2] >> 3); uint32_t rgb_565 = (r5 << 11) | (g6 << 5) | (b5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); @@ -21619,9 +21619,9 @@ wuffs_private_impl__swizzle_bgr_565__bgrx(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t b5 = s[0] >> 3; - uint32_t g6 = s[1] >> 2; - uint32_t r5 = s[2] >> 3; + uint32_t b5 = (uint32_t)(s[0] >> 3); + uint32_t g6 = (uint32_t)(s[1] >> 2); + uint32_t r5 = (uint32_t)(s[2] >> 3); uint32_t rgb_565 = (r5 << 11) | (g6 << 5) | (b5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); @@ -21911,9 +21911,9 @@ wuffs_private_impl__swizzle_bgr_565__rgb(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t r5 = s[0] >> 3; - uint32_t g6 = s[1] >> 2; - uint32_t b5 = s[2] >> 3; + uint32_t r5 = (uint32_t)(s[0] >> 3); + uint32_t g6 = (uint32_t)(s[1] >> 2); + uint32_t b5 = (uint32_t)(s[2] >> 3); uint32_t rgb_565 = (r5 << 11) | (g6 << 5) | (b5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); @@ -22117,8 +22117,8 @@ wuffs_private_impl__swizzle_bgr_565__y(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t y5 = s[0] >> 3; - uint32_t y6 = s[0] >> 2; + uint32_t y5 = (uint32_t)(s[0] >> 3); + uint32_t y6 = (uint32_t)(s[0] >> 2); uint32_t rgb_565 = (y5 << 11) | (y6 << 5) | (y5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565); @@ -22147,8 +22147,8 @@ wuffs_private_impl__swizzle_bgr_565__y_16be(uint8_t* dst_ptr, // TODO: unroll. while (n >= 1) { - uint32_t y5 = s[0] >> 3; - uint32_t y6 = s[0] >> 2; + uint32_t y5 = (uint32_t)(s[0] >> 3); + uint32_t y6 = (uint32_t)(s[0] >> 2); uint32_t rgb_565 = (y5 << 11) | (y6 << 5) | (y5 << 0); wuffs_base__poke_u16le__no_bounds_check(d + (0 * 2), (uint16_t)rgb_565);