From: "Arend van Spriel" <arend@broadcom.com>
To: "David Laight" <David.Laight@ACULAB.COM>
Cc: "Joe Perches" <joe@perches.com>,
"David Miller" <davem@davemloft.net>,
"jeffrey.t.kirsher@intel.com" <jeffrey.t.kirsher@intel.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH net-next] drivers/net: Remove boolean comparisons to true/false
Date: Fri, 10 Feb 2012 10:50:24 +0100 [thread overview]
Message-ID: <4F34E860.1020805@broadcom.com> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B6E65@saturn3.aculab.com>
On 02/10/2012 10:32 AM, David Laight wrote:
>
>> - u32 func_encode = func |
>> - ((is_Pf == true ? 1 : 0) <<
> IGU_FID_ENCODE_IS_PF_SHIFT);
>> + u32 func_encode = func | (is_Pf ? 1 : 0) <<
> IGU_FID_ENCODE_IS_PF_SHIFT;
>
> This sort of thing is why I personally don't like 'bool' at all.
> If 'is_Pf' were an integer type that is known to only contain 0 or 1
> then the code can just be:
Properly chosing the bool type is not what is being handled by the
patch. Easiest way to convert would be using double inversion:
u32 func_encode = func | (!!is_Pf << IGU_FID_ENCODE_IS_PF_SHIFT);
The parenthesis are not needed due to operator precedence, but is more
clear this way (to me at least).
Gr. AvS
next prev parent reply other threads:[~2012-02-10 9:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 10:27 [net-next 0/7][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-02-09 10:27 ` [net-next 1/7] e1000e: remove test that is always false Jeff Kirsher
2012-02-09 10:27 ` [net-next 2/7] e1000e: remove unnecessary returns from void functions Jeff Kirsher
2012-02-09 10:27 ` [net-next 3/7] e1000e: remove unnecessary parentheses Jeff Kirsher
2012-02-09 10:27 ` [net-next 4/7] e1000e: use true/false for bool autoneg_false Jeff Kirsher
2012-02-09 13:15 ` David Laight
2012-02-09 18:34 ` David Miller
2012-02-09 21:17 ` [PATCH net-next] drivers/net: Remove boolean comparisons to true/false Joe Perches
2012-02-09 21:17 ` Joe Perches
2012-02-09 21:28 ` Jeff Kirsher
2012-02-09 21:28 ` Jeff Kirsher
2012-02-09 22:36 ` Allan, Bruce W
2012-02-09 22:36 ` Allan, Bruce W
2012-02-09 23:08 ` Joe Perches
2012-02-10 6:46 ` Julia Lawall
2012-02-10 9:32 ` David Laight
2012-02-10 9:32 ` David Laight
2012-02-10 9:50 ` Arend van Spriel [this message]
2012-02-10 13:04 ` Eric Dumazet
2012-02-10 13:04 ` Eric Dumazet
2012-02-13 5:50 ` David Miller
2012-02-13 5:50 ` David Miller
2012-02-09 10:28 ` [net-next 6/7] e1000e: replace '1' with 'true' for boolean get_link_status Jeff Kirsher
2012-02-09 10:28 ` [net-next 7/7] igb: fix warning about unused function Jeff Kirsher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F34E860.1020805@broadcom.com \
--to=arend@broadcom.com \
--cc=David.Laight@ACULAB.COM \
--cc=davem@davemloft.net \
--cc=jeffrey.t.kirsher@intel.com \
--cc=joe@perches.com \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.