Module: Mesa Branch: main Commit: d8ba1d63bc6ebc1639137843bb543399e6fd9a9e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8ba1d63bc6ebc1639137843bb543399e6fd9a9e
Author: Francisco Jerez <curroje...@riseup.net> Date: Tue Apr 19 15:59:43 2022 -0700 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.olive...@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26860> --- src/intel/compiler/brw_inst.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/intel/compiler/brw_inst.h b/src/intel/compiler/brw_inst.h index 654ef9cb32f..b568817a362 100644 --- a/src/intel/compiler/brw_inst.h +++ b/src/intel/compiler/brw_inst.h @@ -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. */