From 090e71e0bff7291a5bba9a9ff60e7de6bd83c206 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 12 Oct 2022 15:13:19 -0700 Subject: [PATCH] util/indicies: use itertools.product in u_unfilled_gen.py Reviewed-by: Erik Faye-Lund Reviewed-by: Eric Engestrom Part-of: --- src/util/indices/u_unfilled_gen.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/util/indices/u_unfilled_gen.py b/src/util/indices/u_unfilled_gen.py index 8cdf75d7ac0..9dc0a95c732 100644 --- a/src/util/indices/u_unfilled_gen.py +++ b/src/util/indices/u_unfilled_gen.py @@ -24,6 +24,8 @@ copyright = ''' */ ''' +import itertools + GENERATE, UBYTE, USHORT, UINT = 'generate', 'ubyte', 'ushort', 'uint' FIRST, LAST = 'first', 'last' @@ -193,16 +195,15 @@ def tristripadj(intype, outtype): def emit_funcs(): - for intype in INTYPES: - for outtype in OUTTYPES: - tris(intype, outtype) - tristrip(intype, outtype) - trifan(intype, outtype) - quads(intype, outtype) - quadstrip(intype, outtype) - polygon(intype, outtype) - trisadj(intype, outtype) - tristripadj(intype, outtype) + for intype, outtype in itertools.product(INTYPES, OUTTYPES): + tris(intype, outtype) + tristrip(intype, outtype) + trifan(intype, outtype) + quads(intype, outtype) + quadstrip(intype, outtype) + polygon(intype, outtype) + trisadj(intype, outtype) + tristripadj(intype, outtype) def init(intype, outtype, prim): if intype == GENERATE: @@ -219,10 +220,8 @@ def init(intype, outtype, prim): def emit_all_inits(): - for intype in INTYPES: - for outtype in OUTTYPES: - for prim in PRIMS: - init(intype, outtype, prim) + for intype, outtype, prim in itertools.product(INTYPES, OUTTYPES, PRIMS): + init(intype, outtype, prim) def emit_init(): print('void u_unfilled_init( void )')