mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
i965: Add an assert for when SET_FIELD's value exceeds the field size.
This was one of the things we always wanted to do to this, to make it more useful than just (value << FIELD_MASK). Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
parent
98cdb2ceed
commit
5d2e86924e
1 changed files with 7 additions and 1 deletions
|
|
@ -30,7 +30,13 @@
|
|||
*/
|
||||
|
||||
#define INTEL_MASK(high, low) (((1<<((high)-(low)+1))-1)<<(low))
|
||||
#define SET_FIELD(value, field) (((value) << field ## _SHIFT) & field ## _MASK)
|
||||
#define SET_FIELD(value, field) \
|
||||
({ \
|
||||
uint32_t fieldval = (value) << field ## _SHIFT; \
|
||||
assert((fieldval & ~ field ## _MASK) == 0); \
|
||||
fieldval & field ## _MASK; \
|
||||
})
|
||||
|
||||
#define GET_FIELD(word, field) (((word) & field ## _MASK) >> field ## _SHIFT)
|
||||
|
||||
#ifndef BRW_DEFINES_H
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue