[Mesa-dev] [PATCH] genxml: Use llroundf() and store to appropriate type.

Kristian Høgsberg krh at bitplanet.net
Fri May 13 22:06:15 UTC 2016


On Fri, May 13, 2016 at 2:31 PM, Matt Turner <mattst88 at gmail.com> wrote:
> Both functions return uint64_t, so I expect the masking/shifting should
> be done on 64-bit types.

Yea, this is more consistent. We don't have any fixed point fields
over 32 bits, but there's no good reason to mix 32bit and 64bit types
here.

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

> ---
>  src/intel/genxml/gen_pack_header.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py
> index 9ef7122..47870b3 100644
> --- a/src/intel/genxml/gen_pack_header.py
> +++ b/src/intel/genxml/gen_pack_header.py
> @@ -131,7 +131,7 @@ __gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
>     assert(min <= v && v <= max);
>  #endif
>
> -   const int32_t int_val = roundf(v * factor);
> +   const int64_t int_val = llroundf(v * factor);
>     const uint64_t mask = ~0ull >> (64 - (end - start + 1));
>
>     return (int_val & mask) << start;
> @@ -150,7 +150,7 @@ __gen_ufixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
>     assert(min <= v && v <= max);
>  #endif
>
> -   const uint32_t uint_val = roundf(v * factor);
> +   const uint64_t uint_val = llroundf(v * factor);
>
>     return uint_val << start;
>  }
> --
> 2.7.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