[Mesa-dev] [PATCH 07/24] i965/cnl: Update the script generating genX_bits.h

Jason Ekstrand jason at jlekstrand.net
Sat May 13 16:31:47 UTC 2017


On May 12, 2017 4:41:26 PM Anuj Phogat <anuj.phogat at gmail.com> wrote:

> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
>  src/intel/genxml/gen_bits_header.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/intel/genxml/gen_bits_header.py 
> b/src/intel/genxml/gen_bits_header.py
> index ac8ec4c..2fb5f0c 100644
> --- a/src/intel/genxml/gen_bits_header.py
> +++ b/src/intel/genxml/gen_bits_header.py
> @@ -80,6 +80,7 @@ static inline uint32_t ATTRIBUTE_PURE
>  ${item.token_name}_${prop}(const struct gen_device_info *devinfo)
>  {
>     switch (devinfo->gen) {
> +   case 10: return ${item.get_prop(prop, 10)};
>     case 9: return ${item.get_prop(prop, 9)};
>     case 8: return ${item.get_prop(prop, 8)};
>     case 7:
> @@ -168,9 +169,8 @@ class Gen(object):
>      def __init__(self, z):
>          # Convert potential "major.minor" string
>          z = float(z)
> -        if z < 10:
> -            z *= 10
> -        self.tenx = int(z)
> +        z *= 10
> +        self.tenx = int(float(z) * 10)

You're multiplying by 10 twice here and converting to float twice.  Both 
the "z = float(z)" and the "z *= 10" lines can and should be dropped.

>
>      def __lt__(self, other):
>          return self.tenx < other.tenx
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev




More information about the mesa-dev mailing list