Probable boolean logic errors

Michael McConville <[email protected]> Tue, 5 Dec 2017 20:51:43 -0700
Newsgroups gmane.comp.audio.mp3.lame
Message-ID <20171206035143.dwmiqz4c4p5amimo@t240>
Hi guys.

The conditions below don't make much sense because they're clearly always
false. Whoever wrote that code probably meant to use || rather than &&.

Thanks for your time,
Michael McConville
University of Utah

Index: misc/abx.c
===================================================================
--- misc/abx.c	(revision 6425)
+++ misc/abx.c	(working copy)
@@ -745,7 +745,7 @@
             fprintf (stderr, "   Vote for X:=A" );
             eval ( rnd == 0 );
             rnd   = random_number ();
-            if ( state == 6  &&  state == 7 )
+            if ( state == 6  ||  state == 7 )
                 state = 6 + rnd;
             else if ( state != rnd )
                 state = rnd + 2;
@@ -756,7 +756,7 @@
             fprintf (stderr, "   Vote for X:=B" );
             eval ( rnd == 1 );
             rnd   = random_number ();
-            if ( state == 6  &&  state == 7 )
+            if ( state == 6  ||  state == 7 )
                 state = 6 + rnd;
             else if ( state != rnd )
                 state = rnd + 2;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot