Article View: pl.comp.lang.asm
Article #2149Re: Jeszcze prostsza zagadka
From: Andrzej Grażyński
Date: Fri, 19 Mar 2010 18:53
Date: Fri, 19 Mar 2010 18:53
27 lines
1466 bytes
1466 bytes
Bogdan (bogdro) pisze: > W dniu 19.03.2010 11:52, Andrzej Grażyński pisze: >> 386 i wyżej >> >> W EAX jest liczba ze znakiem. Należy w EAX umieścić jej wartość >> bezwzględną. Oczywiście bez skoku. > > Jeszcze dłuższe rozwiązanie :) > > xor ebx, ebx > test eax, eax > sets bl > sub ebx, 1 ; 0 / -1 > mov ecx, eax > and ecx, ebx ; 0 / EAX > neg ecx ; 0 / -EAX > not ebx ; -1 / 0, zamiast drugiego > ; TEST+SETS+SUB, jak słusznie > ; zwrócono mi uwagę > and eax, ebx ; EAX / 0 > add eax, ecx ; EAX / -EAX, można użyć "OR" > CDQ XOR EAX,EDX SUB EAX,EDX
Technical Details
Message-ID:
<ho0h6r$5mq$1@news.onet.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mailReferences:
<hnvl12$khn$1@news.onet.pl> <ho0f39$706$1@inews.gazeta.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail From: Andrzej Grażyński <grazynsk@petex.com.pl> Newsgroups: pl.comp.lang.asm Subject: Re: Jeszcze prostsza zagadka Date: Fri, 19 Mar 2010 19:53:06 +0100 Organization: http://onet.pl Lines: 28 Message-ID: <ho0h6r$5mq$1@news.onet.pl> References: <hnvl12$khn$1@news.onet.pl> <ho0f39$706$1@inews.gazeta.pl> NNTP-Posting-Host: public-gprs86348.centertel.pl Mime-Version: 1.0 X-Trace: news.onet.pl 1269024796 5850 91.94.210.242 (19 Mar 2010 18:53:16 GMT) X-Complaints-To: niusy@onet.pl NNTP-Posting-Date: Fri, 19 Mar 2010 18:53:16 +0000 (UTC) User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) In-Reply-To: <ho0f39$706$1@inews.gazeta.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit