nouveau/headers: Add a MAX_BIT for structs
Reviewed-by: Mel Henning <mhenning@darkrefraction.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36995>
This commit is contained in:
committed by
Marge Bot
parent
00a845a698
commit
0c71f5f1bd
@@ -25,6 +25,7 @@ TEMPLATE_RS = Template("""\
|
||||
use std::ops::Range;
|
||||
|
||||
% for s in structs:
|
||||
pub const ${s.name}_MAX_BIT: usize = ${s.max_bit};
|
||||
% for f in s.fields:
|
||||
% if f.stride:
|
||||
#[inline]
|
||||
@@ -85,9 +86,11 @@ class Struct(object):
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
self.fields = []
|
||||
self.max_bit = 0
|
||||
|
||||
def add_field(self, name, lo, hi, stride=0):
|
||||
self.fields.append(Field(name, lo, hi, stride))
|
||||
self.max_bit = max(self.max_bit, hi)
|
||||
|
||||
DRF_RE = re.compile(r'(?P<hi>[0-9]+):(?P<lo>[0-9]+)')
|
||||
FIELD_NAME_RE = re.compile(r'_?(?P<dw>[0-9]+)?_?(?P<name>.*)')
|
||||
|
||||
Reference in New Issue
Block a user