panfrost: gen_pack: Fix __gen_unpack_uint()
The mask should be a 64-bit value and we should promote cl bytes to u64
before shifting them.
Fixes: 75cc5b8c29
("panfrost: Adopt gen_pack_header.py via v3d")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6797>
This commit is contained in:

committed by
Alyssa Rosenzweig

parent
66f25dd210
commit
ddd82c3ab8
@@ -102,10 +102,10 @@ __gen_unpack_uint(const uint8_t *restrict cl, uint32_t start, uint32_t end)
|
||||
{
|
||||
uint64_t val = 0;
|
||||
const int width = end - start + 1;
|
||||
const uint32_t mask = (width == 32 ? ~0 : (1 << width) - 1 );
|
||||
const uint64_t mask = (width == 64 ? ~0 : (1ull << width) - 1 );
|
||||
|
||||
for (int byte = start / 8; byte <= end / 8; byte++) {
|
||||
val |= cl[byte] << ((byte - start / 8) * 8);
|
||||
val |= ((uint64_t) cl[byte]) << ((byte - start / 8) * 8);
|
||||
}
|
||||
|
||||
return (val >> (start % 8)) & mask;
|
||||
|
Reference in New Issue
Block a user