intel/compiler: Add assume() checks to brw_compact_inst_(set_)bits().

Similar to the preconditions of brw_inst_(set_)bits().

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26860>
This commit is contained in:
Francisco Jerez 2022-04-19 15:59:43 -07:00 committed by Marge Bot
parent 4a24f49b57
commit d8ba1d63bc

View file

@ -1526,6 +1526,8 @@ typedef struct {
static inline unsigned
brw_compact_inst_bits(const brw_compact_inst *inst, unsigned high, unsigned low)
{
assume(high < 64);
assume(high >= low);
const uint64_t mask = (1ull << (high - low + 1)) - 1;
return (inst->data >> low) & mask;
@ -1540,6 +1542,8 @@ static inline void
brw_compact_inst_set_bits(brw_compact_inst *inst, unsigned high, unsigned low,
uint64_t value)
{
assume(high < 64);
assume(high >= low);
const uint64_t mask = ((1ull << (high - low + 1)) - 1) << low;
/* Make sure the supplied value actually fits in the given bitfield. */