lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070224104638.GA3609@suse.cz>
Date:	Sat, 24 Feb 2007 11:46:38 +0100
From:	Vojtech Pavlik <vojtech@...e.cz>
To:	Milind Choudhary <milindchoudhary@...il.com>
Cc:	kernel-janitors@...ts.osdl.org, linux-kernel@...r.kernel.org,
	dmitry.torokhov@...il.com, linux-input@...ey.karlin.mff.cuni.cz,
	linux-joystick@...ey.karlin.mff.cuni.cz
Subject: Re: [KJ][RFC][PATCH] BIT macro cleanup

On Fri, Feb 23, 2007 at 01:44:41PM +0530, Milind Choudhary wrote:
> Hi all
> 	working towards the cleanup of BIT macro,
> I've added one to <linux/bitops.h> & cleaned some obvious users.
> 
> include/linux/input.h also has a BIT macro
> which does a wrap
> so currently i've done something like
> 
> +#undef BIT
> #define BIT(nr)        (1UL << ((nr) % BITS_PER_LONG))
 
Since the previous definition of

#define BIT(nr)		(1UL << (nr))

gives the same results as the above one for all reasonable usage
scenarios (you don't want to supply nr larger than BITS_PER_LONG),
why not just use the modulo version everywhere?

The only problem I see is that the compiler would not warn where nr IS
too large.

-- 
Vojtech Pavlik
Director SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ