All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Veeck <michael.veeck@gmx.net>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [PATCH] add new macro BIT_S to include/linux/kernel.h
Date: Sat, 13 Aug 2005 11:25:15 +0000	[thread overview]
Message-ID: <42FDD89B.1010106@gmx.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

description:
adds a new macro for doing a bitshift. right now every subsystem defines 
its own macro (which all look the same) but this one also does overflow 
checking like it is already done in include/linux/input.h

patch is against latest git-tree from Linus

Signed-off-by: Michael Veeck <michael@veeck.de>


[-- Attachment #2: bitmacro_include-kernel.patch --]
[-- Type: text/plain, Size: 551 bytes --]

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -30,6 +30,11 @@ extern const char linux_banner[];
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
 
+/*
+ * BIT macro that also handles a possible overflow
+ */
+#define BITS(x) (1UL << ((x) % BITS_PER_LONG))
+
 #define	KERN_EMERG	"<0>"	/* system is unusable			*/
 #define	KERN_ALERT	"<1>"	/* action must be taken immediately	*/
 #define	KERN_CRIT	"<2>"	/* critical conditions			*/

[-- Attachment #3: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

             reply	other threads:[~2005-08-13 11:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-13 11:25 Michael Veeck [this message]
2005-08-13 20:26 ` [KJ] [PATCH] add new macro BIT_S to include/linux/kernel.h Alexey Dobriyan
2005-08-13 23:11 ` Michael Veeck
2005-08-25  8:46 ` Domen Puncer
2005-08-25 19:37 ` Michael Veeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42FDD89B.1010106@gmx.net \
    --to=michael.veeck@gmx.net \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.