inline assembler

y2bismil@engmail.uwaterloo.ca y2bismil@engmail.uwaterloo.ca
Wed Nov 5 18:01:00 GMT 2003



Hi all,

I was wondering about inline assember.  I've been reading up quite a bit on it,
and have noticed a common pattern to 'emulate' functions.
***************************************
example from: 
http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html
***************************************
#define times3(arg1, arg2) \
__asm__ ( \
  "leal (%0,%0,2),%0" \
  : "=r" (arg2) \
  : "0" (arg1) );
***************************************

Is there a way in inline assembler to do 'real' functions?  As an example
suppose I have the following:  
#define times3(arg1)__asm__ (...);  /*this results in arg1*3*/

Would there be a way for me to say 
int x = times3(arg1);

My guess is no, but I thought I'd check anyways.

Thanks,

Yamin



----------------------------------------
This mail sent through www.mywaterloo.ca



More information about the Gcc-help mailing list