diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-07-10 08:24:56 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-07-10 08:27:47 +0200 |
commit | 127296ce979dd2764a88d70003a820ce0dcc6df3 (patch) | |
tree | b9e1ba4643cd8e818ac888e0841a8fe1aa607150 | |
parent | Add CONTRIBUTING.md (diff) | |
download | rtems-libbsd-127296ce979dd2764a88d70003a820ce0dcc6df3.tar.bz2 |
libkern.h: Avoid conflict with <strings.h>
-rw-r--r-- | freebsd/sys/sys/libkern.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/freebsd/sys/sys/libkern.h b/freebsd/sys/sys/libkern.h index 5986a740..d236f33b 100644 --- a/freebsd/sys/sys/libkern.h +++ b/freebsd/sys/sys/libkern.h @@ -164,18 +164,29 @@ int flsll(long long); #define ffsl(_x) __builtin_ffsl((unsigned long)(_x)) static inline int -fls(int x) +builtin_fls(int x) { return (x != 0 ? sizeof(x) * 8 - __builtin_clz((unsigned int)x) : 0); } static inline int -flsl(long x) +builtin_flsl(long x) { return (x != 0 ? sizeof(x) * 8 - __builtin_clzl((unsigned long)x) : 0); } + +static inline int +builtin_flsll(long long x) +{ + + return (x != 0 ? sizeof(x) * 8 - __builtin_clzll((unsigned long long)x) : 0); +} + +#define fls(_x) builtin_fls(_x) +#define flsl(_x) builtin_flsl(_x) +#define flsll(_x) builtin_flsll(_x) #endif /* __rtems__ */ #define bitcount64(x) __bitcount64((uint64_t)(x)) #define bitcount32(x) __bitcount32((uint32_t)(x)) |