pan/gen_pack: Fix signed integer packing

Any excess sign-extend bits would spill into adjacent fields, so mask
off anything after the end bit.

Shift from 2 instead of 1, because there needs to be one extra bit in
the mask as 'end' is inclusive.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8130>
This commit is contained in:
Icecream95 2020-12-16 23:03:29 +13:00 committed by Marge Bot
parent e541aa76e2
commit 3a2a005404

View file

@ -78,7 +78,7 @@ __gen_sint(int32_t v, uint32_t start, uint32_t end)
}
#endif
return ((uint32_t) v) << start;
return (((uint32_t) v) << start) & ((2ll << end) - 1);
}
static inline uint32_t