diff options
| author | Lioncash <mathew1800@gmail.com> | 2020-08-03 09:26:34 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2020-08-03 09:31:51 -0400 |
| commit | a1aab876e678a93255334e16b5a2d4d72dea526e (patch) | |
| tree | f4464514cbb8c53211bcda3ec4ace965a2f10585 /src/core/hle/service/nvflinger/buffer_queue.cpp | |
| parent | 9b1ab372a7629e335ab52e8085afa156c1d5cab6 (diff) | |
buffer_queue: Make use of std::nullopt
Allows compilers to eliminate unnecessary zeroing out of the optional's
buffer.
Diffstat (limited to 'src/core/hle/service/nvflinger/buffer_queue.cpp')
| -rw-r--r-- | src/core/hle/service/nvflinger/buffer_queue.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index b723692389..637b310d77 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp @@ -38,7 +38,7 @@ std::optional<std::pair<u32, Service::Nvidia::MultiFence*>> BufferQueue::Dequeue u32 height) { if (free_buffers.empty()) { - return {}; + return std::nullopt; } auto f_itr = free_buffers.begin(); @@ -69,7 +69,7 @@ std::optional<std::pair<u32, Service::Nvidia::MultiFence*>> BufferQueue::Dequeue } if (itr == queue.end()) { - return {}; + return std::nullopt; } itr->status = Buffer::Status::Dequeued; @@ -103,14 +103,15 @@ std::optional<std::reference_wrapper<const BufferQueue::Buffer>> BufferQueue::Ac auto itr = queue.end(); // Iterate to find a queued buffer matching the requested slot. while (itr == queue.end() && !queue_sequence.empty()) { - u32 slot = queue_sequence.front(); + const u32 slot = queue_sequence.front(); itr = std::find_if(queue.begin(), queue.end(), [&slot](const Buffer& buffer) { return buffer.status == Buffer::Status::Queued && buffer.slot == slot; }); queue_sequence.pop_front(); } - if (itr == queue.end()) - return {}; + if (itr == queue.end()) { + return std::nullopt; + } itr->status = Buffer::Status::Acquired; return *itr; } |
