From a19a623d4bfaa7d26ece05ac73c4716e5710d34f Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Fri, 9 Dec 2016 09:56:37 +0900 Subject: [PATCH] Make use of increment/decrement operators of std::atomic. --- ConfigureChecks.cmake | 6 +++--- taglib/toolkit/trefcounter.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 253af335..4b55f273 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -46,9 +46,9 @@ endif() check_cxx_source_compiles(" #include int main() { - std::atomic x; - x.fetch_add(1); - x.fetch_sub(1); + std::atomic_int x; + ++x; + --x; return 0; } " HAVE_STD_ATOMIC) diff --git a/taglib/toolkit/trefcounter.cpp b/taglib/toolkit/trefcounter.cpp index eb2aa69f..6638fcaa 100644 --- a/taglib/toolkit/trefcounter.cpp +++ b/taglib/toolkit/trefcounter.cpp @@ -31,9 +31,9 @@ #if defined(HAVE_STD_ATOMIC) # include -# define ATOMIC_INT std::atomic -# define ATOMIC_INC(x) x.fetch_add(1) -# define ATOMIC_DEC(x) (x.fetch_sub(1) - 1) +# define ATOMIC_INT std::atomic_int +# define ATOMIC_INC(x) (++x) +# define ATOMIC_DEC(x) (--x) #elif defined(HAVE_GCC_ATOMIC) # define ATOMIC_INT int # define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1) -- 2.40.0