mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 00:40:09 +01:00
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:
parent
e541aa76e2
commit
3a2a005404
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue