Polly
20.0.0git
llvm-project
polly
lib
External
isl
isl_ffs.c
Go to the documentation of this file.
1
#include <isl_config.h>
2
3
#if !HAVE_DECL_FFS && !HAVE_DECL___BUILTIN_FFS && HAVE_DECL__BITSCANFORWARD
4
#include <intrin.h>
5
6
/* Implementation of ffs in terms of _BitScanForward.
7
*
8
* ffs returns the position of the least significant bit set in i,
9
* with the least significant bit is position 1, or 0 if not bits are set.
10
*
11
* _BitScanForward returns 1 if mask is non-zero and sets index
12
* to the position of the least significant bit set in i,
13
* with the least significant bit is position 0.
14
*/
15
int
isl_ffs(
int
i)
16
{
17
unsigned
char
non_zero;
18
unsigned
long
index, mask = i;
19
20
non_zero = _BitScanForward(&index, mask);
21
22
return
non_zero ? 1 + index : 0;
23
}
24
#endif
Generated on Fri Jan 31 2025 16:13:30 for Polly by
1.9.6