[rtems-libbsd commit] dpaa: Implement GENMASK() similar to Linux

Sebastian Huber sebh at rtems.org
Mon Oct 23 07:27:51 UTC 2017


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri May 19 09:31:15 2017 +0200

dpaa: Implement GENMASK() similar to Linux

---

 rtemsbsd/powerpc/include/linux/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtemsbsd/powerpc/include/linux/bitops.h b/rtemsbsd/powerpc/include/linux/bitops.h
index 6bed2df..1348697 100644
--- a/rtemsbsd/powerpc/include/linux/bitops.h
+++ b/rtemsbsd/powerpc/include/linux/bitops.h
@@ -45,7 +45,7 @@
 #define	BITS_TO_LONGS(n)	howmany((n), BITS_PER_LONG)
 #define	BIT_MASK(nr)		(1UL << ((nr) & (BITS_PER_LONG - 1)))
 #define BIT_WORD(nr)		((nr) / BITS_PER_LONG)
-#define	GENMASK(hi, lo)		(((2UL << ((hi) - (lo))) - 1UL) << (lo))
+#define	GENMASK(hi, lo)		(((~0UL) << (lo)) & (~0UL >> (BITS_PER_LONG - 1 - (hi))))
 #define BITS_PER_BYTE           8
 
 static inline int




More information about the vc mailing list