Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:15 -0000
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r345913 - stable/12/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201904051110.x35BA9Ah096657@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Apr  5 11:10:09 2019
New Revision: 345913
URL: https://svnweb.freebsd.org/changeset/base/345913

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

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/bitops.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/bitops.h
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/include/linux/bitops.h	Fri Apr  5 11:08:50 2019	(r345912)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/bitops.h	Fri Apr  5 11:10:09 2019	(r345913)
@@ -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)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904051110.x35BA9Ah096657>