Re: [PATCH] 2.4.21-rc1 pointless IDE noise reduction

From: Chuck Ebbert (76306.1226@compuserve.com)
Date: Thu Apr 24 2003 - 18:25:39 EST


Timothy Miller wrote:

> Two alternatives:
>
> (a) !!(x & 0x400)
>
> (b) (x & 0x400) >> 10

I like either of these:

   #define FOO_BITS 0x400
   #define test_mask(t,m) ( !!((t) & (m)) )
   ...
   return test_mask(x, FOO_BITS);

or

   return (x & FOO_BITS) != 0;

Those double exclamation points should be hidden in macros. :)

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



This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:19 EST