Re: [patch 15/44] generic ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()

Roman Zippel <[email protected]>
Newsgroups gmane.linux.ports.ultrapenguin,gmane.linux.kernel,gmane.linux.ports.ia64,gmane.linux.ports.hppa,gmane.linux.ports.sh.devel,gmane.linux.ports.sparc
Message-ID <[email protected]>
Hi,

On Wed, 1 Feb 2006, Akinobu Mita wrote:

> +static __inline__ int generic_test_le_bit(unsigned long nr,
> +				  __const__ unsigned long *addr)
> +{
> +	__const__ unsigned char	*tmp = (__const__ unsigned char *) addr;
> +	return (tmp[nr >> 3] >> (nr & 7)) & 1;
> +}

The underscores are not needed.

For the inline version I would prefer this version:

{
	const unsigned char *tmp = (const unsigned char *)addr;
	return (tmp[nr >> 3] & (unsigned char)(1 << (nr & 7))) != 0;
}

Although this would be a good alternative as well:

{
	return (addr[nr >> 5] & (1 << ((nr ^ 24) & 31))) != 0;
}

bye, Roman
-
To unsubscribe from this list: send the line "unsubscribe ultralinux" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.