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>
}
#endif
- return ((uint32_t) v) << start;
+ return (((uint32_t) v) << start) & ((2ll << end) - 1);
}
static inline uint32_t