[Mesa-dev] [v4, 04/23] intel/common: Add an address de-cannonicalization helper

Scott D Phillips scott.d.phillips at intel.com
Thu May 31 18:06:32 UTC 2018


Jason Ekstrand <jason at jlekstrand.net> writes:

> ---
>  src/intel/common/gen_gem.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
>
> diff --git a/src/intel/common/gen_gem.h b/src/intel/common/gen_gem.h
> index 842a455..eef6a5e 100644
> --- a/src/intel/common/gen_gem.h
> +++ b/src/intel/common/gen_gem.h
> @@ -40,4 +40,14 @@ gen_canonical_address(uint64_t v)
>     return (int64_t)(v << shift) >> shift;
>  }
>  
> +/**
> + * This is the opposite of gen_canonicalize_address
> + */
> +static inline uint64_t
> +gen_48b_address(uint64_t v)
> +{
> +   const int shift = 63 - 47;
> +   return (uint64_t)(v << shift) >> shift;

The cast from uint64_t to uint64_t seems like a bit of unnecessary
distraction, but it's like the other one so either way:

Reviewed-by: Scott D Phillips <scott.d.phillips at intel.com>

> +}
> +
>  #endif /* GEN_GEM_H */


More information about the mesa-dev mailing list