mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
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:
parent
4a24f49b57
commit
d8ba1d63bc
1 changed files with 4 additions and 0 deletions
|
|
@ -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. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue