* [PATCH 1/1] remove BITS_TO_TYPE macro
@ 2007-08-26 14:08 Jiri Slaby
2007-08-26 15:54 ` Robert P. J. Day
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby @ 2007-08-26 14:08 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
remove BITS_TO_TYPE macro
I realized, that it is actually the same as DIV_ROUND_UP, use it instead.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
commit c1b003cd9e5befbc3d915a9e37f46585127f9d1f
tree d800859baebde3f7fcb001801d32c528c4240250
parent 5a28a23f3c53993aaf6e7ef6c392e5f4c20d4a3b
author Jiri Slaby <jirislaby@gmail.com> Sun, 26 Aug 2007 15:50:39 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sun, 26 Aug 2007 15:50:39 +0200
include/linux/bitops.h | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a57b81f..8b5ecf8 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -6,8 +6,7 @@
#define BIT(nr) (1UL << (nr))
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
-#define BITS_TO_TYPE(nr, t) (((nr)+(t)-1)/(t))
-#define BITS_TO_LONGS(nr) BITS_TO_TYPE(nr, BITS_PER_LONG)
+#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
#define BITS_PER_BYTE 8
#endif
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] remove BITS_TO_TYPE macro
2007-08-26 14:08 [PATCH 1/1] remove BITS_TO_TYPE macro Jiri Slaby
@ 2007-08-26 15:54 ` Robert P. J. Day
0 siblings, 0 replies; 2+ messages in thread
From: Robert P. J. Day @ 2007-08-26 15:54 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Andrew Morton, linux-kernel
On Sun, 26 Aug 2007, Jiri Slaby wrote:
> remove BITS_TO_TYPE macro
>
> I realized, that it is actually the same as DIV_ROUND_UP, use it instead.
unless there are some patches in the queue, the whole area of rounding
up and aligning is still sort of messy.
kernel.h defines the following:
...
#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
...
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
...
yet there is no corresponding DIV_ROUND_DOWN() or rounddown(), just
for the sake of consistency. (maybe there's simply no need?)
would someone like to propose a single, consistent standard for those
things? or is it not worth it?
rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://crashcourse.ca
========================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-26 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-26 14:08 [PATCH 1/1] remove BITS_TO_TYPE macro Jiri Slaby
2007-08-26 15:54 ` Robert P. J. Day
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®