[Mesa-dev] [PATCH] mesa: remove _mesa_ffs(), implement ffs() for non-GNU platforms

Alexander von Gluck kallisti5 at unixzen.com
Wed Jan 11 19:06:24 PST 2012


On 11.01.2012 14:50, Brian Paul wrote:
> Call ffs() and ffsll() everywhere.  Define our own ffs(), ffsll()
> functions when the platform doesn't have them.
> ---
>  src/mesa/main/imports.c                  |   11 ++++++-----

> diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
> index 2469e42..b3d56db 100644
> --- a/src/mesa/main/imports.c
> +++ b/src/mesa/main/imports.c
> @@ -458,7 +458,7 @@ _mesa_inv_sqrtf(float n)
>   * Find the first bit set in a word.
>   */
>  int
> -_mesa_ffs(int32_t i)
> +ffs(int i)
>  {
>  #if (defined(_WIN32) ) || defined(__IBMC__) || defined(__IBMCPP__)

This seems like a bad idea... infinite recursion.
ffs calls itself if it's non-gnuc and !WIN && !IBM.

This is why I changed everything to call _mesa_ffs.
Otherwise it does seem to work ok under Haiku as we don't fall into
that trap.

Thanks!
  -- Alex


More information about the mesa-dev mailing list