www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/09/19:46:03

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: MAJOR slowdowns in translating TP7 gfx code to DJGPP2: Suplement 2
Date: Wed, 09 Sep 1998 19:16:56 -0300
Organization: NBTel Internet
Lines: 37
Message-ID: <35F6FE58.D5AF4B52@unb.ca>
References: <35F6CB8F DOT 1772 AT post DOT tau DOT ac DOT il>
NNTP-Posting-Host: fctnts10c05.nbnet.nb.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Tal Lavi wrote:
> I inlined my own div function.
> Here it is, for your comments:
> 
>         typedef struct
>         {
>           unsigned short quot;
>           unsigned short rem;
>         } short_div_t;
> 
>         short_div_t short_div(unsigned short numberator,
>                               unsigned short denomonator)
>         {
>           short_div_t short_div;
>           __asm__ __volatile__("
>             divw %%bx"
>           :"=a"(short_div.quot),"=d"(short_div.rem)
>           :"a"(numberator),"d"((unsigned short)0),"b"(denomonator)
>           :"ax","bx","dx"
>           );
>           return(short_div);
>         }
> 
> Can I #define the inline asm command, instead of calling a real
> function?
> and does it worth my time?
	That is not an inline function.  Just add the word 'inline' before the return
type and it will become as fast as it can.


-- 
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT GeoCities DOT com
          Endlis AT nbnet DOT nb DOT ca


- Raw text -


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