diff options
| author | 2020-12-07 01:53:37 -0500 | |
|---|---|---|
| committer | 2020-12-07 01:53:40 -0500 | |
| commit | 5d2f18fbcdca61b3bf140e92bf1c7d5b163aa580 (patch) | |
| tree | 97f4a13530a49e517105139da56f8e703d98f991 /src | |
| parent | buffer_block: Remove unnecessary includes (diff) | |
| download | yuzu-5d2f18fbcdca61b3bf140e92bf1c7d5b163aa580.tar.gz yuzu-5d2f18fbcdca61b3bf140e92bf1c7d5b163aa580.tar.xz yuzu-5d2f18fbcdca61b3bf140e92bf1c7d5b163aa580.zip | |
buffer_block: Mark interface as nodiscard where applicable
Prevents logic errors from occurring from unused values.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_block.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/video_core/buffer_cache/buffer_block.h b/src/video_core/buffer_cache/buffer_block.h index eee6908b1..e9306194a 100644 --- a/src/video_core/buffer_cache/buffer_block.h +++ b/src/video_core/buffer_cache/buffer_block.h | |||
| @@ -10,23 +10,23 @@ namespace VideoCommon { | |||
| 10 | 10 | ||
| 11 | class BufferBlock { | 11 | class BufferBlock { |
| 12 | public: | 12 | public: |
| 13 | bool Overlaps(VAddr start, VAddr end) const { | 13 | [[nodiscard]] bool Overlaps(VAddr start, VAddr end) const { |
| 14 | return (cpu_addr < end) && (cpu_addr_end > start); | 14 | return (cpu_addr < end) && (cpu_addr_end > start); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | bool IsInside(VAddr other_start, VAddr other_end) const { | 17 | [[nodiscard]] bool IsInside(VAddr other_start, VAddr other_end) const { |
| 18 | return cpu_addr <= other_start && other_end <= cpu_addr_end; | 18 | return cpu_addr <= other_start && other_end <= cpu_addr_end; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | std::size_t Offset(VAddr in_addr) const { | 21 | [[nodiscard]] std::size_t Offset(VAddr in_addr) const { |
| 22 | return static_cast<std::size_t>(in_addr - cpu_addr); | 22 | return static_cast<std::size_t>(in_addr - cpu_addr); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | VAddr CpuAddr() const { | 25 | [[nodiscard]] VAddr CpuAddr() const { |
| 26 | return cpu_addr; | 26 | return cpu_addr; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | VAddr CpuAddrEnd() const { | 29 | [[nodiscard]] VAddr CpuAddrEnd() const { |
| 30 | return cpu_addr_end; | 30 | return cpu_addr_end; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| @@ -35,11 +35,11 @@ public: | |||
| 35 | cpu_addr_end = new_addr + size; | 35 | cpu_addr_end = new_addr + size; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | std::size_t Size() const { | 38 | [[nodiscard]] std::size_t Size() const { |
| 39 | return size; | 39 | return size; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | u64 Epoch() const { | 42 | [[nodiscard]] u64 Epoch() const { |
| 43 | return epoch; | 43 | return epoch; |
| 44 | } | 44 | } |
| 45 | 45 | ||