Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1603695 > unrolled thread

[PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS

Started byWei Yang <richard.weiyang@gmail.com>
First post2017-03-18 02:20 +0100
Last post2017-03-18 02:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS Wei Yang <richard.weiyang@gmail.com> - 2017-03-18 02:20 +0100

#1603695 — [PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS

FromWei Yang <richard.weiyang@gmail.com>
Date2017-03-18 02:20 +0100
Subject[PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS
Message-ID<tmbcd-71X-1@gated-at.bofh.it>
The second parameter is the number of bits for type "long", which is
already defined in header file.

This patch replace the calculation with macro to make it more readable.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 include/linux/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a83c822c35c2..923fe72d31e3 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,7 +10,7 @@
 #define BIT_ULL_MASK(nr)	(1ULL << ((nr) % BITS_PER_LONG_LONG))
 #define BIT_ULL_WORD(nr)	((nr) / BITS_PER_LONG_LONG)
 #define BITS_PER_BYTE		8
-#define BITS_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
+#define BITS_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_LONG)
 #endif
 
 /*
-- 
2.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web