diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2021-09-24 21:43:30 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2021-09-27 18:56:14 +0200 |
commit | ef21ed78ae5a3dd0b30e4b247ec3774347cadb4d (patch) | |
tree | ede8fea13c42dea36b502c00ce4805642086be8e | |
parent | 6a186dd1e85cecac84f0bc5cc32c0e47fd33994f (diff) | |
download | lvm2-ef21ed78ae5a3dd0b30e4b247ec3774347cadb4d.tar.gz |
utils: define macro for ffs
Provide ffs() macro using __builtin_ffs(), when there is missing
ffs() implementation in header file.
Reported-by: adamboardman of gemian
-rw-r--r-- | lib/misc/util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/misc/util.h b/lib/misc/util.h index a42ecb355..35514eee0 100644 --- a/lib/misc/util.h +++ b/lib/misc/util.h @@ -89,6 +89,14 @@ static unsigned _dm_clzll(unsigned long long x) #define clzll(x) _dm_clzll((x)) #endif /* ifdef HAVE___BUILTIN_CLZLL */ +#ifndef HAVE_FFS +#ifdef HAVE___BUILTIN_FFS +#define ffs(x) __builtin_ffs((x)) +#else +#error ffs() not implemented! +#endif /* ifdef HAVE___BUILTIN_FFS */ +#endif /* ifndef HAVE_FFS */ + #define KERNEL_VERSION(major, minor, release) (((major) << 16) + ((minor) << 8) + (release)) /* Define some portable printing types */ |