<div dir="ltr"><div><div><div><div>Your link isn't really valid in this context. The logical equivalence applies to singular bits, not to a multibit value.<br></div>0x10 & 0x01 evaluates to 0x00 (== false), while 0x10 && 0x01 evaluates to 0x01 (a true value).<br></div>Those switch statements will always end up in cases 0 or 1.<br></div><div>Further, logical operators && and || are lazy, while bitwise operators & and | are not.<br></div><div><br></div>Regards,<br></div>Mario.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-06-21 0:30 GMT-03:00 Kevin Brace <span dir="ltr"><<a href="mailto:kevinbrace@gmx.com" target="_blank">kevinbrace@gmx.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Xavier,<br>
<br>
><br>
> Signed-off-by: Xavier Bachelot <<a href="mailto:xavier@bachelot.org">xavier@bachelot.org</a>><br>
> ---<br>
>  src/via_outputs.c | 24 ++++++++++++------------<br>
>  1 file changed, 12 insertions(+), 12 deletions(-)<br>
><br>
> diff --git a/src/via_outputs.c b/src/via_outputs.c<br>
> index 7e21e8c..30602dd 100644<br>
> --- a/src/via_outputs.c<br>
> +++ b/src/via_outputs.c<br>
> @@ -1045,7 +1045,7 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)<br>
>          /* 3C5.12[4] - FPD17 pin strapping<br>
>           *             0: TMDS transmitter (DVI) / capture device<br>
>           *             1: Flat panel */<br>
> -        if (sr12 && 0x10) {<br>
> +        if (sr12 & 0x10) {<br>
>              xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                          "A flat panel is connected to "<br>
>                          "flat panel interface.\n");<br>
> @@ -1065,7 +1065,7 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)<br>
>          /* 3C5.12[5] - FPD18 pin strapping<br>
>           *             0: TMDS transmitter (DVI)<br>
>           *             1: TV encoder */<br>
> -        if (sr12 && 0x20) {<br>
> +        if (sr12 & 0x20) {<br>
>              xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                          "A TMDS transmitter (DVI) is connected to "<br>
>                          "DVI port.\n");<br>
> @@ -1079,17 +1079,17 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)<br>
>               *               01: NTSC<br>
>               *               10: PAL-N<br>
>               *               11: PAL-NC */<br>
> -            if (sr13 && 0x04) {<br>
> +            if (sr13 & 0x04) {<br>
>                  xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                              "NTSC for the TV encoder.\n");<br>
>              } else {<br>
> -                if (!(sr13 && 0x08)) {<br>
> +                if (!(sr13 & 0x08)) {<br>
>                      xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                                  "PAL for the TV encoder.\n");<br>
>                  } else {<br>
>                      xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                                  "PAL%s for the TV encoder.\n",<br>
> -                                sr13 && 0x04 ? "-NC" : "-N");<br>
> +                                sr13 & 0x04 ? "-NC" : "-N");<br>
>                  }<br>
>              }<br>
>  @@ -1098,7 +1098,7 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)<br>
>               *             1: 625 lines (PAL) */<br>
>              xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                          "%s lines for the TV encoder.\n",<br>
> -                        sr12 && 0x40 ? "625" : "525");<br>
> +                        sr12 & 0x40 ? "625" : "525");<br>
>          }<br>
>           break;<br>
> @@ -1112,12 +1112,12 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)<br>
>           *                DVI or TV out use<br>
>           *             1: Enable DVP0 (Digital Video Port 0) for<br>
>           *                DVI or TV out use */<br>
> -        if (sr12 && 0x40) {<br>
> +        if (sr12 & 0x40) {<br>
>               /* 3C5.12[5] - DVP0D5 pin strapping<br>
>               *             0: TMDS transmitter (DVI)<br>
>               *             1: TV encoder */<br>
> -            if (sr12 && 0x20) {<br>
> +            if (sr12 & 0x20) {<br>
>                  xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                              "A TV encoder is detected on "<br>
>                              "DVP0 (Digital Video Port 0).\n");<br>
> @@ -1133,12 +1133,12 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)<br>
>           *             0: AGP pins are used for AGP<br>
>           *             1: AGP pins are used by FPDP<br>
>           *             (Flat Panel Display Port) */<br>
> -        if (sr13 && 0x08) {<br>
> +        if (sr13 & 0x08) {<br>
>               /* 3C5.12[4] - DVP0D4 pin strapping<br>
>               *             0: Dual 12-bit FPDP (Flat Panel Display Port)<br>
>               *             1: 24-bit FPDP  (Flat Panel Display Port) */<br>
> -            if (sr12 && 0x10) {<br>
> +            if (sr12 & 0x10) {<br>
>                  xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                              "24-bit FPDP (Flat Panel Display Port) "<br>
>                              "detected.\n");<br>
> @@ -1159,7 +1159,7 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)<br>
>                   * 3C5.12[5] - DVP0D5 pin strapping<br>
>                   *             0: TMDS transmitter (DVI)<br>
>                   *             1: TV encoder */<br>
> -                if ((!(sr12 && 0x40)) && (!(sr12 && 0x20))) {<br>
> +                if ((!(sr12 & 0x40)) && (!(sr12 & 0x20))) {<br>
>                      xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                                  "A TV encoder is connected to "<br>
>                                  "FPDP (Flat Panel Display Port).\n");<br>
> @@ -1206,7 +1206,7 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)<br>
>           *               01: DVI + LVDS2<br>
>           *               10: Dual LVDS Channel (High Resolution Panel)<br>
>           *               11: One DVI only (decrease the clock jitter) */<br>
> -        switch (sr13 && 0xC0) {<br>
> +        switch (sr13 & 0xC0) {<br>
>          case 0x00:<br>
>              xf86DrvMsg(pScrn->scrnIndex, X_INFO,<br>
>                          "LVDS1 + LVDS2 detected.\n");<br>
> --<br>
> 2.5.5<br>
><br>
><br>
<br>
<br>
I am rejecting the inclusion of the patch.<br>
See the below website.<br>
<br>
<a href="https://en.wikipedia.org/wiki/Bitwise_operations_in_C#Logical_equivalents" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Bitwise_operations_in_C#Logical_equivalents</a><br>
<br>
I handled the matter correctly.<br>
<br>
Regards,<br>
<br>
Kevin Brace<br>
_______________________________________________<br>
Openchrome-devel mailing list<br>
<a href="mailto:Openchrome-devel@lists.freedesktop.org">Openchrome-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/openchrome-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/openchrome-devel</a><br>
</blockquote></div><br></div>