Date: Thu, 10 Apr 2003 12:28:18 -0700 (PDT) From: Nate Lawson <nate@root.org> To: Warner Losh <imp@harmony.village.org> Cc: John Baldwin <jhb@FreeBSD.org> Subject: Re: cvs commit: src/sys/dev/pccard pccard.c pccardvar.h Message-ID: <Pine.BSF.4.21.0304101227410.32138-100000@root.org> In-Reply-To: <200304101837.h3AIbGA7021295@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 10 Apr 2003, Warner Losh wrote: > In message <XFMail.20030410124202.jhb@FreeBSD.org> John Baldwin writes: > : At this point it doesn't matter since you only check one field now, but > : there was definitely a logic bug in both 1.76 and 1.78. If you want to > : terminate a loop when both a and b are zero, you can do either: > : > : for (...; a != 0 || b != 0; ...) > : > : or: > : > : for (...; !(a == 0 && b == 0); ...) > : > : However, both 1.76 and 1.78 did: > : > : for (...; a != 0 && b != 0; ...) > : > : Which will terminate the first time either a or b is zero, not when > : both are zero. The fact that my wavelan card didn't probe until > : 1.77 should help to prove that. > > Actually, this is the classic problem of the contrapositive: > > (!(a == 0 && b == 0))) == (a != 0 || b != 0) > > So there was a logic bug. > > Warner DeMorgan is rolling over in his grave. :) -Nate
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0304101227410.32138-100000>