[rtems-libbsd commit] Provide ffs() and ffsl() via builtins

Sebastian Huber sebh at rtems.org
Mon Nov 2 08:11:58 UTC 2015


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Oct 30 14:14:46 2015 +0100

Provide ffs() and ffsl() via builtins

---

 freebsd/sys/sys/libkern.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/freebsd/sys/sys/libkern.h b/freebsd/sys/sys/libkern.h
index acdedda..dcdd802 100644
--- a/freebsd/sys/sys/libkern.h
+++ b/freebsd/sys/sys/libkern.h
@@ -88,12 +88,17 @@ void	 arc4rand(void *ptr, u_int len, int reseed);
 int	 bcmp(const void *, const void *, size_t);
 void	*bsearch(const void *, const void *, size_t,
 	    size_t, int (*)(const void *, const void *));
+#ifndef __rtems__
 #ifndef	HAVE_INLINE_FFS
 int	 ffs(int);
 #endif
 #ifndef	HAVE_INLINE_FFSL
 int	 ffsl(long);
 #endif
+#else /* __rtems__ */
+#define	ffs(_x) __builtin_ffs((unsigned int)(_x))
+#define	ffsl(_x) __builtin_ffsl((unsigned long)(_x))
+#endif /* __rtems__ */
 #ifndef	HAVE_INLINE_FLS
 int	 fls(int);
 #endif




More information about the vc mailing list