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>
return int(element.attrib['start'], 0)
-base_types = [
+BASE_TYPES = {
'address',
'offset',
'int',
'uint',
'bool',
'float',
-]
+}
FIXED_PATTERN = re.compile(r"(s|u)(\d+)\.(\d+)")
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):
if node.tag == 'field':