lkml.org 
[lkml]   [2008]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 4/5] rt2x00: Compiler warning unmasked by fix of BUILD_BUG_ON
From
On Sep. 01, 2008, 16:21 +0300, Boaz Harrosh <bharrosh@panasas.com> wrote:
> A "Set" of the sign-bit in an "&" operation causes a compiler warning.
> Make calculations unsigned.
>
> [ The warning was masked by the use of (void)() cast in the old
> BUILD_BUG_ON() ]
>
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> TO: Ivo van Doorn <IvDoorn@gmail.com>
> TO: John W. Linville <linville@tuxdriver.com>
> CC: Ingo Molnar <mingo@elte.hu>
> CC: Rusty Russell <rusty@rustcorp.com.au>
> ---
> drivers/net/wireless/rt2x00/rt2x00reg.h | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
> index 7e88ce5..c0e8706 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00reg.h
> +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
> @@ -134,8 +134,8 @@ struct rt2x00_field32 {
> * Note that we cannot use the is_power_of_2() function since this
> * check must be done at compile-time.
> */
> -#define is_power_of_two(x) ( !((x) & ((x)-1)) )
> -#define low_bit_mask(x) ( ((x)-1) & ~(x) )
> +#define is_power_of_two(x) ( !((unsigned)(x) & ((x)-1)) )
> +#define low_bit_mask(x) ( ((unsigned)(x)-1) & ~(x) )

Why not unsigned long?

Benny

> #define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x))
>
> /*
> --
> 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/



\
 
 \ /
  Last update: 2008-09-01 15:31    [W:0.188 / U:1.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site