diff --git a/src/external/atomic_queue/atomic_queue.h b/src/external/atomic_queue/atomic_queue.h index 731d9a11..23536adc 100644 --- a/src/external/atomic_queue/atomic_queue.h +++ b/src/external/atomic_queue/atomic_queue.h @@ -28,34 +28,13 @@ namespace details { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -template -struct GetCacheLineIndexBits { - static int constexpr value = 0; -}; -template<> -struct GetCacheLineIndexBits<64> { - static int constexpr value = 6; -}; -template<> -struct GetCacheLineIndexBits<32> { - static int constexpr value = 5; -}; -template<> -struct GetCacheLineIndexBits<16> { - static int constexpr value = 4; -}; -template<> -struct GetCacheLineIndexBits<8> { - static int constexpr value = 3; -}; -template<> -struct GetCacheLineIndexBits<4> { - static int constexpr value = 2; -}; -template<> -struct GetCacheLineIndexBits<2> { - static int constexpr value = 1; -}; +template struct GetCacheLineIndexBits { static int constexpr value = 0; }; +template<> struct GetCacheLineIndexBits<64> { static int constexpr value = 6; }; +template<> struct GetCacheLineIndexBits<32> { static int constexpr value = 5; }; +template<> struct GetCacheLineIndexBits<16> { static int constexpr value = 4; }; +template<> struct GetCacheLineIndexBits< 8> { static int constexpr value = 3; }; +template<> struct GetCacheLineIndexBits< 4> { static int constexpr value = 2; }; +template<> struct GetCacheLineIndexBits< 2> { static int constexpr value = 1; }; template struct GetIndexShuffleBits { @@ -321,7 +300,7 @@ public: static_cast(*this).do_push(std::forward(element), head); } - Derived& pop() noexcept { + Derived pop() noexcept { unsigned tail; if(Derived::spsc_) { tail = tail_.load(X); @@ -342,7 +321,7 @@ public: return static_cast(head_.load(X) - tail_.load(X)) >= static_cast(static_cast(*this).size_); } - unsigned size() const noexcept { + unsigned capacity() const noexcept { return static_cast(*this).size_; } }; @@ -491,7 +470,7 @@ public: void swap(AtomicQueueB& b) noexcept { using std::swap; - swap(static_cast(*this), static_cast(b)); + this->Base::swap(b); swap(static_cast(*this), static_cast(b)); swap(size_, b.size_); swap(elements_, b.elements_); @@ -532,13 +511,13 @@ class AtomicQueueB2 : public AtomicQueueCommon(tail % (size_ - 1)); + unsigned index = details::remap_index(tail & (size_ - 1)); return Base::template do_pop_any(states_[index], elements_[index]); } template void do_push(U&& element, unsigned head) noexcept { - unsigned index = details::remap_index(head % (size_ - 1)); + unsigned index = details::remap_index(head & (size_ - 1)); Base::template do_push_any(std::forward(element), states_[index], elements_[index]); } @@ -588,7 +567,7 @@ public: void swap(AtomicQueueB2& b) noexcept { using std::swap; - swap(static_cast(*this), static_cast(b)); + this->Base::swap(b); swap(static_cast(*this), static_cast(b)); swap(static_cast(*this), static_cast(b)); swap(size_, b.size_); diff --git a/src/external/atomic_queue/defs.h b/src/external/atomic_queue/defs.h index 49d7d615..c73b4539 100644 --- a/src/external/atomic_queue/defs.h +++ b/src/external/atomic_queue/defs.h @@ -45,7 +45,7 @@ static inline void spin_loop_pause() noexcept { namespace atomic_queue { -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) #define ATOMIC_QUEUE_LIKELY(expr) __builtin_expect(static_cast(expr), 1) #define ATOMIC_QUEUE_UNLIKELY(expr) __builtin_expect(static_cast(expr), 0) #else diff --git a/src/sfizz/FilePool.cpp b/src/sfizz/FilePool.cpp index cf80f33b..d5471a12 100644 --- a/src/sfizz/FilePool.cpp +++ b/src/sfizz/FilePool.cpp @@ -245,7 +245,7 @@ sfz::FilePromisePtr sfz::FilePool::getFilePromise(const std::string& filename) n promise->creationTime = std::chrono::high_resolution_clock::now(); if (!promiseQueue.try_push(promise)) { - DBG("[sfizz] Could not enqueue the promise for " << filename << " (queue size " << promiseQueue.size() << ")"); + DBG("[sfizz] Could not enqueue the promise for " << filename << " (queue capacity " << promiseQueue.capacity() << ")"); return {}; }