svn commit: r345093 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Wed Mar 13 17:55:59 UTC 2019


Author: hselasky
Date: Wed Mar 13 17:55:58 2019
New Revision: 345093
URL: https://svnweb.freebsd.org/changeset/base/345093

Log:
  Implement BITS_PER_TYPE() function macro in the LinuxKPI.
  Fix some style while at it.
  
  Submitted by:		Johannes Lundberg <johalun0 at gmail.com>
  MFC after:		1 week
  Sponsored by:		Limelight Networks
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h	Wed Mar 13 17:51:08 2019	(r345092)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h	Wed Mar 13 17:55:58 2019	(r345093)
@@ -51,10 +51,11 @@
 #define	BITMAP_LAST_WORD_MASK(n)	(~0UL >> (BITS_PER_LONG - (n)))
 #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	BIT_WORD(nr)		((nr) / BITS_PER_LONG)
 #define	GENMASK(h, l)		(((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l)))
 #define	GENMASK_ULL(h, l)	(((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
-#define BITS_PER_BYTE		8
+#define	BITS_PER_BYTE		8
+#define	BITS_PER_TYPE(t)	(sizeof(t) * BITS_PER_BYTE)
 
 #define	hweight8(x)	bitcount((uint8_t)(x))
 #define	hweight16(x)	bitcount16(x)


More information about the svn-src-head mailing list