intel/genxml: use a set for lookups
Python will pre-compute the set since it's const, and the performance of a set search is significantly better than that of a list search Reviewd-by: Jordan Justen <jordan.l.justen@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18917>
This commit is contained in:
@@ -21,19 +21,19 @@ def get_start(element):
|
|||||||
return int(element.attrib['start'], 0)
|
return int(element.attrib['start'], 0)
|
||||||
|
|
||||||
|
|
||||||
base_types = [
|
BASE_TYPES = {
|
||||||
'address',
|
'address',
|
||||||
'offset',
|
'offset',
|
||||||
'int',
|
'int',
|
||||||
'uint',
|
'uint',
|
||||||
'bool',
|
'bool',
|
||||||
'float',
|
'float',
|
||||||
]
|
}
|
||||||
|
|
||||||
FIXED_PATTERN = re.compile(r"(s|u)(\d+)\.(\d+)")
|
FIXED_PATTERN = re.compile(r"(s|u)(\d+)\.(\d+)")
|
||||||
|
|
||||||
def is_base_type(name):
|
def is_base_type(name):
|
||||||
return name in base_types or FIXED_PATTERN.match(name)
|
return name in BASE_TYPES or FIXED_PATTERN.match(name)
|
||||||
|
|
||||||
def add_struct_refs(items, node):
|
def add_struct_refs(items, node):
|
||||||
if node.tag == 'field':
|
if node.tag == 'field':
|
||||||
|
Reference in New Issue
Block a user