Mercurial > projects > ldc
changeset 615:c60e122f4ada
Fix atomicIncr and atomicDecr. Probably.
The unittest for tango.core.Atomic now passes.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 21 Sep 2008 18:41:27 +0200 |
parents | 452e6e2618bf |
children | 5ced42a55aa9 |
files | runtime/llvmdc.diff |
diffstat | 1 files changed, 7 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/llvmdc.diff Sun Sep 21 17:35:27 2008 +0200 +++ b/runtime/llvmdc.diff Sun Sep 21 18:41:27 2008 +0200 @@ -248,7 +248,7 @@ =================================================================== --- tango/core/Atomic.d (revision 3939) +++ tango/core/Atomic.d (working copy) -@@ -270,6 +270,173 @@ +@@ -270,6 +270,167 @@ //////////////////////////////////////////////////////////////////////////////// @@ -373,16 +373,13 @@ + { + static if (isPointerType!(T)) + { -+ return cast(T)llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 1); ++ llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 1); + } -+ else static if (is(T == bool)) -+ { -+ return llvm_atomic_load_add!(ubyte)(cast(ubyte*)&val, 1)?1:0; -+ } + else + { -+ return llvm_atomic_load_add!(T)(&val, cast(T)1); ++ llvm_atomic_load_add!(T)(&val, cast(T)1); + } ++ return val; + } + } + @@ -404,16 +401,13 @@ + { + static if (isPointerType!(T)) + { -+ return cast(T)llvm_atomic_load_sub!(size_t)(cast(size_t*)&val, 1); ++ llvm_atomic_load_sub!(size_t)(cast(size_t*)&val, 1); + } -+ else static if (is(T == bool)) -+ { -+ return llvm_atomic_load_sub!(ubyte)(cast(ubyte*)&val, 1)?1:0; -+ } + else + { -+ return llvm_atomic_load_sub!(T)(&val, cast(T)1); ++ llvm_atomic_load_sub!(T)(&val, cast(T)1); + } ++ return val; + } + } +}