v3d: use uint type in _gen_unpack_uint

Use a unsigned int type in the loop to avoid unintended sign extensions.

Fixes CID#1414500 (Unintended sign extension [SIGN_EXTENSION]).

Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10060>
This commit is contained in:
Juan A. Suarez Romero 2021-04-06 16:45:20 +02:00 committed by Marge Bot
parent d760a995e3
commit eddbbd8b68

View file

@ -165,7 +165,7 @@ __gen_unpack_uint(const uint8_t *restrict cl, uint32_t start, uint32_t end)
const int width = end - start + 1;
const uint32_t mask = (width == 32 ? ~0 : (1 << width) - 1 );
for (int byte = start / 8; byte <= end / 8; byte++) {
for (uint32_t byte = start / 8; byte <= end / 8; byte++) {
val |= cl[byte] << ((byte - start / 8) * 8);
}