DEV Community

Discussion on: How can you swap two variables without using a third?

Collapse
 
josephscade profile image
josephscade

Let's say the two values are in the EAX and EBX registers. Here is the fastest :

push eax
push ebx
pop eax
pop ebx