diff options
author | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-07-04 17:02:58 +0200 |
---|---|---|
committer | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-07-04 17:02:58 +0200 |
commit | f1cfd9c2197e3e0c8409b869714b599d96e079c0 (patch) | |
tree | dd7530264e9299aa8f5bdec7ab445807a55e3d54 /src | |
parent | Use spans over guest memory where possible instead of copying data. (diff) | |
download | yuzu-f1cfd9c2197e3e0c8409b869714b599d96e079c0.tar yuzu-f1cfd9c2197e3e0c8409b869714b599d96e079c0.tar.gz yuzu-f1cfd9c2197e3e0c8409b869714b599d96e079c0.tar.bz2 yuzu-f1cfd9c2197e3e0c8409b869714b599d96e079c0.tar.lz yuzu-f1cfd9c2197e3e0c8409b869714b599d96e079c0.tar.xz yuzu-f1cfd9c2197e3e0c8409b869714b599d96e079c0.tar.zst yuzu-f1cfd9c2197e3e0c8409b869714b599d96e079c0.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/common/scratch_buffer.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h index d5961b020..2a98cda53 100644 --- a/src/common/scratch_buffer.h +++ b/src/common/scratch_buffer.h @@ -40,8 +40,21 @@ public: ~ScratchBuffer() = default; ScratchBuffer(const ScratchBuffer&) = delete; ScratchBuffer& operator=(const ScratchBuffer&) = delete; - ScratchBuffer(ScratchBuffer&&) = default; - ScratchBuffer& operator=(ScratchBuffer&&) = default; + + ScratchBuffer(ScratchBuffer&& other) noexcept { + swap(other); + other.last_requested_size = 0; + other.buffer_capacity = 0; + other.buffer.reset(); + } + + ScratchBuffer& operator=(ScratchBuffer&& other) noexcept { + swap(other); + other.last_requested_size = 0; + other.buffer_capacity = 0; + other.buffer.reset(); + return *this; + } /// This will only grow the buffer's capacity if size is greater than the current capacity. /// The previously held data will remain intact. |