summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/bit_util.h1
-rw-r--r--src/common/multi_level_queue.h14
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;
}