[rtems-libbsd commit] libkern.h: Avoid conflict with <strings.h>

Sebastian Huber sebh at rtems.org
Mon Jul 10 06:27:59 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    127296ce979dd2764a88d70003a820ce0dcc6df3
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=127296ce979dd2764a88d70003a820ce0dcc6df3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jul 10 08:24:56 2017 +0200

libkern.h: Avoid conflict with <strings.h>

---

 freebsd/sys/sys/libkern.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/freebsd/sys/sys/libkern.h b/freebsd/sys/sys/libkern.h
index 5986a74..d236f33 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))



More information about the vc mailing list