Assembly language > Assembly discussions

Need help with swap macro function

(1/1)

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?


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

--- End code ---

Thanks! :)

TimoVJL:

--- Code: ---#define exchange(a,b) __asm { __asm mov eax, a \
                        __asm xchg eax, b \
                        __asm mov a, eax }
--- End code ---

Navigation

[0] Message Index

Go to full version