NO

Author Topic: Need help with swap macro function  (Read 4160 times)

xteraco

  • Guest
Need help with swap macro function
« 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! :)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Need help with swap macro function
« Reply #1 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 }
May the source be with you