Pelles C forum

Assembly language => Assembly discussions => Topic started by: xteraco on July 06, 2013, 04:57:06 PM

Title: Need help with swap macro function
Post by: xteraco on July 06, 2013, 04:57:06 PM
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: [Select]
#define exchange(a,b)   __asm mov eax, a \
                        __asm xchg eax, b \
                        __asm mov a, eax 

Thanks! :)
Title: Re: Need help with swap macro function
Post by: TimoVJL on July 06, 2013, 05:53:45 PM
Code: [Select]
#define exchange(a,b) __asm { __asm mov eax, a \
                        __asm xchg eax, b \
                        __asm mov a, eax }