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

Ian Romanick idr at freedesktop.org
Tue Apr 19 23:46:25 UTC 2016


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 03/31/2016 05:04 PM, Dylan Baker wrote:
> 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"'
> 



More information about the mesa-dev mailing list