From 8779583bdb8b6d0e48a50533df7bccf8b9a39a9c Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Thu, 5 Jan 2017 08:40:23 +0100 Subject: [PATCH] boost ring queue: use % to wrap the index For power of 2, it is replaced with a single and instruction. If it potentially faster than branch. But it worths a benchmark --- plugins/GSdx/boost_spsc_queue.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/GSdx/boost_spsc_queue.hpp b/plugins/GSdx/boost_spsc_queue.hpp index cd595e95d9..eb8158598c 100644 --- a/plugins/GSdx/boost_spsc_queue.hpp +++ b/plugins/GSdx/boost_spsc_queue.hpp @@ -91,11 +91,12 @@ public: { size_t ret = arg + 1; #if 0 + // Initial boost code while (unlikely(ret >= max_size)) -#else - while (ret >= max_size) -#endif ret -= max_size; +#else + ret %= max_size; +#endif return ret; }