3 ms·
The following snippet swaps two values (rax, rcx) only if they are out of order (i.e. rax > rcx). It does so without using any branches. mov rdx, rax cmp r
by utopcell 9y ago
The following snippet swaps two values (rax, rcx)
only if they are out of order (i.e. rax > rcx).
It does so without using any branches.
mov rdx, rax
cmp rax, rcx
cmovg rax, rcx
cmovg rcx, rdx