mirror of
https://github.com/libretro/x86-assembly-cheat.git
synced 2026-11-07 12:47:59 -10:00
17 lines
284 B
NASM
17 lines
284 B
NASM
; # XADD
|
|
|
|
; Add and swap.
|
|
|
|
; Useful syncrhonization primitive to make an atomc addition,
|
|
; this is how C++ atomic ++ is implemented in GCC 5.1.
|
|
|
|
%include "lib/asm_io.inc"
|
|
|
|
ENTRY
|
|
mov eax, 1
|
|
mov ebx, 2
|
|
xadd eax, ebx
|
|
ASSERT_EQ 3
|
|
ASSERT_EQ ebx, 1
|
|
EXIT
|