Need help with swap macro function

Started by xteraco, July 06, 2013, 04:57:06 PM

Previous topic - Next topic

xteraco

I found this swap macro function on stackoverflow that is written in assembly.  When I try to compile with it I get 3 errors that say "[asm] Expression with multiple C symbols is not allowed."

Any idea how I can get this code to work?


#define exchange(a,b)   __asm mov eax, a \
                        __asm xchg eax, b \
                        __asm mov a, eax 


Thanks! :)

TimoVJL

#define exchange(a,b) __asm { __asm mov eax, a \
                        __asm xchg eax, b \
                        __asm mov a, eax }
May the source be with you