C++ requires explicit casts from integers to enums. Fixes errors like
the following when trying to use Asahi GenXML from a GTest unit test.
src/asahi/lib/agx_pack.h:554:23: error: assigning to 'enum agx_channels' from incompatible type 'uint64_t' (aka 'unsigned long long')
values->channels = __gen_unpack_uint(cl, 0, 6);
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14903>
if field.modifier[0] == "log2":
prefix = "1 << "
+ if field.type in self.parser.enums:
+ prefix = f"(enum {enum_name(field.type)}) {prefix}"
+
decoded = '{}{}({}){}'.format(prefix, convert, ', '.join(args), suffix)
print(' values->{} = {};'.format(fieldref.path, decoded))