[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
warning question
- Date: Mon, 11 May 2009 21:22:28 +0200
- From: arnout at mind.be (Arnout Vandecappelle)
- Subject: warning question
On Wednesday 06 May 2009 17:49:28 Joel Sherrill wrote:
> Hi,
>
> I am looking at warnings and wondered if someone
> could figured this one out.
>
> c/src/libchip/network/i82586.c:1722: warning: suggest parentheses around
> operand of '!' or change '|' to '||' or '!' to '~'
>
> The code is clearly questionable IMO. ;)
>
> *IE_CMD_CFG_PROMISC(buf) = !!promiscuous | manchester << 2;
This means (!!promiscuous) | (manchester << 2). It looks OK to me, though
adding parenthases around as I did certainly makes things clearer.
The !! is a trick to make sure you have a 1, not just any non-zero int.
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: D206 D44B 5155 DF98 550D 3F2A 2213 88AA A1C7 C933