diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-03-20 03:20:15 +0100 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-03-27 19:49:43 +0100 |
commit | db42bcb306323d6221e7f893d39558c3db579bf3 (patch) | |
tree | ef23218b123f80a0c2a773908a6fa2685cd34898 /src/common | |
parent | Fixes to multilevelqueue's iterator. (diff) | |
download | yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.gz yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.bz2 yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.lz yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.xz yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.tar.zst yuzu-db42bcb306323d6221e7f893d39558c3db579bf3.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/bit_util.h | 1 | ||||
-rw-r--r-- | src/common/multi_level_queue.h | 14 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/common/bit_util.h b/src/common/bit_util.h index 70e728a5e..a4f9ed4aa 100644 --- a/src/common/bit_util.h +++ b/src/common/bit_util.h @@ -59,7 +59,6 @@ inline u64 CountLeadingZeroes64(u64 value) { } #endif - #ifdef _MSC_VER inline u32 CountTrailingZeroes32(u32 value) { unsigned long trailing_zero = 0; diff --git a/src/common/multi_level_queue.h b/src/common/multi_level_queue.h index 68b35ffaa..2b61b91e0 100644 --- a/src/common/multi_level_queue.h +++ b/src/common/multi_level_queue.h @@ -7,12 +7,21 @@ #include <array> #include <iterator> #include <list> +#include <utility> #include "common/bit_util.h" #include "common/common_types.h" namespace Common { +/** + * A MultiLevelQueue is a type of priority queue which has the following characteristics: + * - iteratable through each of its elements. + * - back can be obtained. + * - O(1) add, lookup (both front and back) + * - discrete priorities and a max of 64 priorities (limited domain) + * This type of priority queue is normaly used for managing threads within an scheduler + */ template <typename T, std::size_t Depth> class MultiLevelQueue { public: @@ -37,9 +46,7 @@ public: friend bool operator==(const iterator_impl& lhs, const iterator_impl& rhs) { if (lhs.IsEnd() && rhs.IsEnd()) return true; - if (lhs.current_priority == rhs.current_priority) - return lhs.it == rhs.it; - return false; + return std::tie(lhs.current_priority, lhs.it) == std::tie(rhs.current_priority, rhs.it); } friend bool operator!=(const iterator_impl& lhs, const iterator_impl& rhs) { @@ -301,7 +308,6 @@ private: using const_list_iterator = typename std::list<T>::const_iterator; static void ListShiftForward(std::list<T>& list, const std::size_t shift = 1) { - // NOTE: May want to consider making this an assertion or something if (shift >= list.size()) { return; } |