summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-19 04:37:06 +0200
committerLioncash <mathew1800@gmail.com>2018-09-19 05:35:57 +0200
commitc51f8563a66af6fa65f5b486ee3b86f5249415b9 (patch)
tree9993a4e398a6b0d8edf23d0683109cf5f29bea4e /src/common
parentMerge pull request #1348 from ogniK5377/GetImageSize (diff)
downloadyuzu-c51f8563a66af6fa65f5b486ee3b86f5249415b9.tar
yuzu-c51f8563a66af6fa65f5b486ee3b86f5249415b9.tar.gz
yuzu-c51f8563a66af6fa65f5b486ee3b86f5249415b9.tar.bz2
yuzu-c51f8563a66af6fa65f5b486ee3b86f5249415b9.tar.lz
yuzu-c51f8563a66af6fa65f5b486ee3b86f5249415b9.tar.xz
yuzu-c51f8563a66af6fa65f5b486ee3b86f5249415b9.tar.zst
yuzu-c51f8563a66af6fa65f5b486ee3b86f5249415b9.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/ring_buffer.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/common/ring_buffer.h b/src/common/ring_buffer.h
index 45926c9ec..0fd5b86f0 100644
--- a/src/common/ring_buffer.h
+++ b/src/common/ring_buffer.h
@@ -9,6 +9,7 @@
#include <atomic>
#include <cstddef>
#include <cstring>
+#include <new>
#include <type_traits>
#include <vector>
#include "common/common_types.h"
@@ -102,8 +103,15 @@ public:
private:
// It is important to align the below variables for performance reasons:
// Having them on the same cache-line would result in false-sharing between them.
- alignas(128) std::atomic<std::size_t> m_read_index{0};
- alignas(128) std::atomic<std::size_t> m_write_index{0};
+ // TODO: Remove this ifdef whenever clang and GCC support
+ // std::hardware_destructive_interference_size.
+#if defined(_MSC_VER) && _MSC_VER >= 1911
+ alignas(std::hardware_destructive_interference_size) std::atomic_size_t m_read_index{0};
+ alignas(std::hardware_destructive_interference_size) std::atomic_size_t m_write_index{0};
+#else
+ alignas(128) std::atomic_size_t m_read_index{0};
+ alignas(128) std::atomic_size_t m_write_index{0};
+#endif
std::array<T, granularity * capacity> m_data;
};