Date: Mon, 13 Jun 2005 14:51:02 +0200 From: "Norbert Koch" <NKoch@demig.de> To: <gerarra@tin.it>, <freebsd-hackers@freebsd.org> Cc: hselasky@c2i.net Subject: RE: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h) Message-ID: <000001c57016$8e4b0600$4801a8c0@ws-ew-3.W2KDEMIG> In-Reply-To: <429C8E8F00015E63@ims3a.cp.tin.it>
next in thread | previous in thread | raw e-mail | index | archive | help
> >So
> >how can I fix this in assembly. I am not an expert with inlined assembly,
> >so
> >maybe someone can correct me if I am wrong, but something like this needs
> >to
> >be added:
> >
> >or %ecx, %ecx
> >jz 2
> >
> >2:
>
> This is wrong beacause the result is stored in ecx. Better using
> JECXZ instruction
> before the loop.
>
> Greeting,
> rookie
No, it's a correct method to set/reset the zero flag:
(X | X) == X just as (X & X) == X
So, he could also write: "and %ecx, %ecx".
I may be wrong, but in the old 386/486 days the "jecxz" was even less
efficient, wasn't it?
<history>
Twenty years ago, my z80 programs had a lot of lines like
and a
ret z
Weren't there discussions, if an nmos cpu consumed more electric power with
either "and a" or "or a"? ;-)
</history>
Norbert
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000001c57016$8e4b0600$4801a8c0>
