[Mesa-dev] Rename mesa/src/util (Was: gallium/util: add u_bit_scan64)

Jose Fonseca jfonseca at vmware.com
Wed Feb 4 06:04:38 PST 2015


This change broke MinGW/MSVC builds because ffsll is not available there.


There is a ffsll C fallback, but it's in src/mesa/main/imports.[ch].  So 
rather than duplicating it in src/gallium/auxiliary/util/u_math.h I'd 
prefer move it to src/util.


And here lies the problem: what header name should be used for math helpers?


I think the filenames in src/util and the directory itself is poorly 
named for something that is meant to be included by some many other 
components:
- there is no unique prefix in most headers
- util/ clashes with src/gallium/auxiliary/util/


Hence I'd like to propose to:

- rename src/util to something unique (e.g, cgrt, for Common Graphics 
RunTime

And maybe:

- prefix all header/source files in there with a cgrt_* unique prefix too

And maybe in the future

- use cgrt_* prefix for symbols too.


Jose



On 01/02/15 17:15, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> Same as u_bit_scan, but for uint64_t.
> ---
>   src/gallium/auxiliary/util/u_math.h | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
> index 19c7343..f5d3487 100644
> --- a/src/gallium/auxiliary/util/u_math.h
> +++ b/src/gallium/auxiliary/util/u_math.h
> @@ -587,6 +587,13 @@ u_bit_scan(unsigned *mask)
>      return i;
>   }
>
> +static INLINE int
> +u_bit_scan64(uint64_t *mask)
> +{
> +   int i = ffsll(*mask) - 1;
> +   *mask &= ~(1llu << i);
> +   return i;
> +}
>
>   /**
>    * Return float bits.
>



More information about the mesa-dev mailing list