Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11682 from lioncash/queue
Common: Move FixedSizeQueue into Common namespace
  • Loading branch information
AdmiralCurtiss committed Mar 24, 2023
2 parents eb7d783 + 0f326c6 commit 2edb69f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/SurroundDecoder.h
Expand Up @@ -29,7 +29,7 @@ class SurroundDecoder

std::unique_ptr<DPL2FSDecoder> m_fsdecoder;
std::array<float, 32768> m_float_conversion_buffer;
FixedSizeQueue<float, 32768> m_decoded_fifo;
Common::FixedSizeQueue<float, 32768> m_decoded_fifo;
};

} // namespace AudioCommon
3 changes: 3 additions & 0 deletions Source/Core/Common/FixedSizeQueue.h
Expand Up @@ -13,6 +13,8 @@
//
// Not fully featured, no safety checking yet. Add features as needed.

namespace Common
{
template <class T, int N>
class FixedSizeQueue
{
Expand Down Expand Up @@ -84,3 +86,4 @@ class FixedSizeQueue
// Sacrifice 4 bytes for a simpler implementation. may optimize away in the future.
int count = 0;
};
} // namespace Common
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt/Config/LogWidget.h
Expand Up @@ -52,5 +52,5 @@ class LogWidget final : public QDockWidget, Common::Log::LogListener
static constexpr int MAX_LOG_LINES = 5000;

std::mutex m_log_mutex;
FixedSizeQueue<LogEntry, MAX_LOG_LINES> m_log_ring_buffer;
Common::FixedSizeQueue<LogEntry, MAX_LOG_LINES> m_log_ring_buffer;
};
6 changes: 3 additions & 3 deletions Source/UnitTests/Common/FixedSizeQueueTest.cpp
Expand Up @@ -7,7 +7,7 @@

TEST(FixedSizeQueue, Simple)
{
FixedSizeQueue<int, 5> q;
Common::FixedSizeQueue<int, 5> q;

EXPECT_EQ(0u, q.size());

Expand All @@ -34,7 +34,7 @@ TEST(FixedSizeQueue, Simple)
TEST(FixedSizeQueue, RingBuffer)
{
// Testing if queue works when used as a ring buffer
FixedSizeQueue<int, 5> q;
Common::FixedSizeQueue<int, 5> q;

EXPECT_EQ(0u, q.size());

Expand Down Expand Up @@ -84,7 +84,7 @@ class NonTrivialTypeTestData
TEST(FixedSizeQueue, NonTrivialTypes)
{
// Testing if construction/destruction of non-trivial types happens as expected
FixedSizeQueue<NonTrivialTypeTestData, 2> q;
Common::FixedSizeQueue<NonTrivialTypeTestData, 2> q;

EXPECT_EQ(0u, q.size());

Expand Down

0 comments on commit 2edb69f

Please sign in to comment.