[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3400f2f60907121708x5edb854ch898af7e8e55d3497@mail.gmail.com>
Date: Sun, 12 Jul 2009 19:08:01 -0500
From: "J. K. Cliburn" <jcliburn@...il.com>
To: Roel Kluin <roel.kluin@...il.com>
Cc: atl1-devel@...ts.sourceforge.net,
Andrew Morton <akpm@...ux-foundation.org>,
netdev <netdev@...r.kernel.org>, Jie Yang <jie.yang@...eros.com>
Subject: Re: [PATCH] atl1c: add missing parentheses
Adding Jie (Atheros maintainer) to cc list.
On Sun, Jul 12, 2009 at 4:40 PM, Roel Kluin<roel.kluin@...il.com> wrote:
> Parentheses are required or the comparison occurs before the bitand.
>
> Signed-off-by: Roel Kluin <roel.kluin@...il.com>
> ---
> #include <stdio.h>
> int main()
> {
> printf("0 & 1 == 0: %u\n", 0 & 1 == 0);
> printf("1 & 1 == 0: %u\n", 1 & 1 == 0);
> printf("(0 & 1) == 0: %u\n", (0 & 1) == 0);
> printf("(1 & 1) == 0: %u\n", (1 & 1) == 0);
> return 0;
> }
>
> output:
> 0 & 1 == 0: 0
> 1 & 1 == 0: 0
> (0 & 1) == 0: 1
> (1 & 1) == 0: 0
>
> diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
> index e1658ef..2a1120a 100644
> --- a/drivers/net/atl1c/atl1c.h
> +++ b/drivers/net/atl1c/atl1c.h
> @@ -188,14 +188,14 @@ struct atl1c_tpd_ext_desc {
> #define RRS_HDS_TYPE_DATA 2
>
> #define RRS_IS_NO_HDS_TYPE(flag) \
> - (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == 0)
> + ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == 0)
>
> #define RRS_IS_HDS_HEAD(flag) \
> - (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \
> + ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == \
> RRS_HDS_TYPE_HEAD)
>
> #define RRS_IS_HDS_DATA(flag) \
> - (((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \
> + ((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == \
> RRS_HDS_TYPE_DATA)
>
> /* rrs word 3 bit 0:31 */
> @@ -245,7 +245,7 @@ struct atl1c_tpd_ext_desc {
> #define RRS_PACKET_TYPE_802_3 1
> #define RRS_PACKET_TYPE_ETH 0
> #define RRS_PACKET_IS_ETH(word) \
> - (((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK == \
> + ((((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK) == \
> RRS_PACKET_TYPE_ETH)
> #define RRS_RXD_IS_VALID(word) \
> ((((word) >> RRS_RXD_UPDATED_SHIFT) & RRS_RXD_UPDATED_MASK) == 1)
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists