From 3954f14c6d7043804a85f2cbbad1b7e335162276 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 7 Dec 2020 01:52:13 -0500 Subject: buffer_block: Remove unnecessary includes Reduces the amount of dependencies the header pulls in. --- src/video_core/buffer_cache/buffer_block.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/buffer_cache/buffer_block.h b/src/video_core/buffer_cache/buffer_block.h index e64170e66..eee6908b1 100644 --- a/src/video_core/buffer_cache/buffer_block.h +++ b/src/video_core/buffer_cache/buffer_block.h @@ -4,12 +4,7 @@ #pragma once -#include -#include - -#include "common/alignment.h" #include "common/common_types.h" -#include "video_core/gpu.h" namespace VideoCommon { -- cgit v1.2.3 From 5d2f18fbcdca61b3bf140e92bf1c7d5b163aa580 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 7 Dec 2020 01:53:37 -0500 Subject: buffer_block: Mark interface as nodiscard where applicable Prevents logic errors from occurring from unused values. --- src/video_core/buffer_cache/buffer_block.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/video_core') 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 { class BufferBlock { public: - bool Overlaps(VAddr start, VAddr end) const { + [[nodiscard]] bool Overlaps(VAddr start, VAddr end) const { return (cpu_addr < end) && (cpu_addr_end > start); } - bool IsInside(VAddr other_start, VAddr other_end) const { + [[nodiscard]] bool IsInside(VAddr other_start, VAddr other_end) const { return cpu_addr <= other_start && other_end <= cpu_addr_end; } - std::size_t Offset(VAddr in_addr) const { + [[nodiscard]] std::size_t Offset(VAddr in_addr) const { return static_cast(in_addr - cpu_addr); } - VAddr CpuAddr() const { + [[nodiscard]] VAddr CpuAddr() const { return cpu_addr; } - VAddr CpuAddrEnd() const { + [[nodiscard]] VAddr CpuAddrEnd() const { return cpu_addr_end; } @@ -35,11 +35,11 @@ public: cpu_addr_end = new_addr + size; } - std::size_t Size() const { + [[nodiscard]] std::size_t Size() const { return size; } - u64 Epoch() const { + [[nodiscard]] u64 Epoch() const { return epoch; } -- cgit v1.2.3