diff options
| author | Chia-I Wu <olv@lunarg.com> | 2014-12-19 14:39:08 +0800 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-02-04 17:57:22 -0700 |
| commit | 1cd88be8e097895c6a51301d044cd9d79ce45772 (patch) | |
| tree | acb25ac9e9e483eedf2a6015353bf1b65f7f08a4 | |
| parent | 5a327e08466b8281ed18040b92ac81cccdb30a0d (diff) | |
| download | usermoji-1cd88be8e097895c6a51301d044cd9d79ce45772.tar.xz | |
icd: add u_ffs()
| -rw-r--r-- | icd/common/icd-utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/icd/common/icd-utils.h b/icd/common/icd-utils.h index fdefd16b..76d8fa9c 100644 --- a/icd/common/icd-utils.h +++ b/icd/common/icd-utils.h @@ -31,6 +31,7 @@ #include <stdbool.h> #include <stdint.h> #include <assert.h> +#include <strings.h> /* for ffs() */ #include "icd.h" #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) @@ -53,6 +54,11 @@ static inline bool u_is_pow2(unsigned int val) return ((val & (val - 1)) == 0); } +static inline int u_ffs(int val) +{ + return ffs(val); +} + static inline unsigned int u_align(unsigned int val, unsigned alignment) { assert(alignment && u_is_pow2(alignment)); |
