delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/24/15:18:41

From: "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Faster-than-shift travel
Date: Thu, 24 Jun 1999 14:30:36 -0400
Organization: Nortel Networks
Lines: 24
Message-ID: <3772794B.3D3F0738@americasm01.nt.com>
References: <37726F12 DOT 9D1D3EB4 AT ameritech DOT net>
NNTP-Posting-Host: bmerhc00.ca.nortel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.6 [en] (X11; I; HP-UX B.10.20 9000/712)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

S Prasad wrote:

> Hello. Just have a newbie-at-asm question :-)
> int i = 256;
> I'd like to copy the high byte into the low byte, and save the low byte
> as the var 'i'.  Sorta like this:
>
> asm(" movb %%ah, %%al
>     : "=al" (i)
>     : "a" (i)
>     : "%eax");
>
> Can I, using the output registers, just save AL to the variable i, so
> that I just get the low byte?

    I'm not sure of the syntax, but that can be done.  But, unless you are
optimizing for 486 (or 386), there is no point, a shift takes 1 cycle on
Classic Pentium/K6 (and above).

--
     -Rolf Campbell (39)3-6318



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019