[Openchrome-devel] [PATCH v2] Properly use bitwise operators in viaProbePinStrapping
Benno Schulenberg
bensberg at justemail.net
Tue Jun 21 08:29:37 UTC 2016
On Tue, Jun 21, 2016, at 08:04, Kevin Brace wrote:
> I used the language correctly in this case, and I do not like
> wasting time on small issues like this.
Two people are trying to tell you are making a mistake.
Maybe it is time to pause and think a bit?
Or maybe write a little program with a few values and
using both & and && and see what it does?
> For an if statement, it is the expectation that logical operators
> are going to be used since an if statement is ultimately looking
> for a true or false.
The operators can be anything you like, the if checks only
whether the result is nonzero, which means true.
So doing 'if (something && 0x20)' is the same as doing
'if (something && TRUE)' is the same as 'if (something)'.
But, doing 'if (something & 0x20)' will only be true if bit 6
in something is set.
Benno
--
http://www.fastmail.com - Email service worth paying for. Try it for free
More information about the Openchrome-devel
mailing list