Mail Archives: djgpp/1998/01/25/16:45:39
From: | "d-range!" <d-range AT thefridge DOT et DOT fnt DOT hvu DOT nl>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | WATCOM #pragma to DJGPP __asm__ ?!!
|
Date: | 25 Jan 1998 21:13:39 GMT
|
Organization: | World Online
|
Lines: | 43
|
Message-ID: | <01bc0b04$94dfc940$6089f1c3@faktor21>
|
NNTP-Posting-Host: | hlv1-p96.worldonline.nl
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Heya,
I recently decided to switch from WATCOM to DJGPP, to make my code more
portable, but I ran into the following 'problem' making the code compilable
under DJGPP:
In WATCOM I used #pragma's to define inline functions - example:
typedef Fixed int;
Fixed FixSHR(Fixed,char);
#pragma aux FixSHR="sar eax,cl",\
parm [eax] [ecx] modify [eax] value [eax];
void main(void)
{
Fixed a,b;
a=FixSHR(b,2); // so a=4*b ;))
}
My question: how can I make inline functions like this one to work with
DJGPP. I read the DJGPP assembler tutorial, and I know you can #define the
function like this,
#define FixSHR(arg1,arg2,arg3) __asm__ \
"sarl %1,%0" \
: "=r" (arg3) \
: "0" (arg1), "1" (arg2) \
: "0";
or something like that. The result will be in arg3 I think. Since I don't
feel like rewriting every FixMul(), FixDiv(), FixSHR(), FixSHL() etc (there
are 1000s of 'em ;-( ) I was wondering if someone knows a way to make it
work like it did with watcom. I'd be grateful ;)
regards,
=============================================
d-range! - coder <d-range AT thefridge DOT et DOT fnt DOT hvu DOT nl>
=============================================
- Raw text -