[Mesa-dev] [PATCH 40/41] glapi: gl_x86_asm.py: simplify method with sum and generator

Dylan Baker baker.dylan.c at gmail.com
Fri Apr 1 00:04:57 UTC 2016


Rather than using a loop, and augmenting a variable use a generator and
sum to achieve the same result.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 src/mapi/glapi/gen/gl_x86_asm.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index f2825cf..320d825 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -46,14 +46,8 @@ class PrintGenericStubs(gl_XML.gl_print_base):
             "BRIAN PAUL, IBM")
 
     def get_stack_size(self, f):
-        size = 0
-        for p in f.parameterIterator():
-            if p.is_padding:
-                continue
-
-            size += p.get_stack_size()
-
-        return size
+        return sum(p.get_stack_size() for p in f.parameterIterator()
+                   if not p.is_padding)
 
     def printRealHeader(self):
         print '#include "x86/assyntax.h"'
-- 
2.8.0



More information about the mesa-dev mailing list