mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
gallium/util: Use HAVE___BUILTIN_FFS* macros.
Make use of the builtin ffs macros and split out ffsll to a seperate block. Needed for at least OpenBSD which does not have ffsll in libc. Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
8cce7b05f1
commit
726d99b197
1 changed files with 16 additions and 2 deletions
|
|
@ -383,13 +383,27 @@ unsigned ffs( unsigned u )
|
|||
|
||||
return i;
|
||||
}
|
||||
#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
|
||||
#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID) || \
|
||||
defined(HAVE___BUILTIN_FFS)
|
||||
#define ffs __builtin_ffs
|
||||
#define ffsll __builtin_ffsll
|
||||
#endif
|
||||
|
||||
#endif /* FFS_DEFINED */
|
||||
|
||||
/**
|
||||
* Find first bit set in long long. Least significant bit is 1.
|
||||
* Return 0 if no bits set.
|
||||
*/
|
||||
#ifndef FFSLL_DEFINED
|
||||
#define FFSLL_DEFINED 1
|
||||
|
||||
#if defined(__MINGW32__) || defined(PIPE_OS_ANDROID) || \
|
||||
defined(HAVE___BUILTIN_FFSLL)
|
||||
#define ffsll __builtin_ffsll
|
||||
#endif
|
||||
|
||||
#endif /* FFSLL_DEFINED */
|
||||
|
||||
/**
|
||||
* Find last bit set in a word. The least significant bit is 1.
|
||||
* Return 0 if no bits are set.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue