[Issue 12891] add atomicFetchAdd and atomicFetchSub to core.atomic

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Apr 5 13:14:00 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=12891

--- Comment #5 from Martin Nowak <code at dawg.eu> ---
(In reply to Jonathan Dunlap from comment #4)
Depending on the size of mod you need to use a smaller register.

static if (V1.sizeof == 1) asm { mov AL, mod; }
static if (V1.sizeof == 2) asm { mov AX, mod; }
static if (V1.sizeof == 4) asm { mov EAX, mod; }
static if (V1.sizeof == 8) asm { mov RAX, mod; }

Likewise you need to load the pointer (ref) into a fitting register.

mov EDX, val; // x86
mov RDX, val; // x86_64

--


More information about the Digitalmars-d-bugs mailing list