[Openchrome-devel] [PATCH v2] Properly use bitwise operators in viaProbePinStrapping
Mario J. Rugiero
mrugiero at gmail.com
Tue Jun 21 06:18:28 UTC 2016
El 21/06/16 a las 03:04, Kevin Brace escribió:
> Hi Mario,
> By the way, the swtich statement thing was already fixed.
> 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.
> I used the language correctly in this case, and I do not like wasting time on small issues like this.
> OpenChrome still has too many problems in the code.
If statements do expect true or false, but any non-zero value is true
for them. That's why the equivalence is not true in this case.
if (sr12 && 0x10)
if (sr12 && 0x20)
Will execute the true branch if and only if sr12 evaluates to *any*
non-zero value, regardless of which non-zero value the constant to its
right has, since with regards to the && operator both constants are
simply true. Either the intent is to solely evaluate sr12 truth value
(in which case, the '&& constant' should go away, or to evaluate the 9th
and 10th bits (counting from the rightmost bit) in sr12 to be 1, in
which case we want the binary operator, not the logical one.
> Kevin Brace
> P.S. Mario, I prefer if you do not keep sending HTML e-mails to OpenChrome mailing lists since the mailing list does not like HTML e-mails.
Sorry about that, I generally use Thunderbird and forget to configure
More information about the Openchrome-devel