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: 75cc5b8c2922 ("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>
diff --git a/src/panfrost/lib/gen_pack.py b/src/panfrost/lib/gen_pack.py
index 2dbf2d0..3cf96eb 100644
--- a/src/panfrost/lib/gen_pack.py
+++ b/src/panfrost/lib/gen_pack.py
@@ -102,10 +102,10 @@
{
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;