inline assembler
y2bismil@engmail.uwaterloo.ca
y2bismil@engmail.uwaterloo.ca
Wed Nov 5 18:13:00 GMT 2003
[snip]
> Just define an inline function:
>
> static inline int times3(int x) {
> int r;
> asm(...);
> return r;
> }
>
> --
> Falk
>
Yeah, I was thinking about that. But I'm a bit hesitent to do that. I'm not
quite sure how it would affect the program. Some parts don't want the stack
modified...so this might cause a problem with function calls. Right now, we're
using watcom c, and they have the #pragma aux ... type statements for inline
assembler. This allows for such things as long as u specify which register
the return value will be in.
For example, they can do the following and use it directly like a function
*********************************************
uns * CALC_POR_PTR(gaddr addr_first_par) ;
#pragma aux CALC_POR_PTR \
= "lea eax, [ebp+4]" \
parm nomemory [eax] \
value [EAX] \
modify exact nomemory [EAX] ;
*********************************************
Thanks for the help,
Yamin
----------------------------------------
This mail sent through www.mywaterloo.ca
More information about the Gcc-help
mailing list