Skip to content
Snippets Groups Projects
Unverified Commit 902bf6d3 authored by bunnei's avatar bunnei Committed by GitHub
Browse files

Merge pull request #4574 from lioncash/const-fn

memory_manager: Mark IsGranularRange() as a const member function
parents 2cd788b6 5bce81c3
No related branches found
No related tags found
No related merge requests found
...@@ -316,10 +316,10 @@ void MemoryManager::CopyBlockUnsafe(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_add ...@@ -316,10 +316,10 @@ void MemoryManager::CopyBlockUnsafe(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_add
WriteBlockUnsafe(gpu_dest_addr, tmp_buffer.data(), size); WriteBlockUnsafe(gpu_dest_addr, tmp_buffer.data(), size);
} }
bool MemoryManager::IsGranularRange(GPUVAddr gpu_addr, std::size_t size) { bool MemoryManager::IsGranularRange(GPUVAddr gpu_addr, std::size_t size) const {
const auto cpu_addr{GpuToCpuAddress(gpu_addr)}; const auto cpu_addr{GpuToCpuAddress(gpu_addr)};
if (!cpu_addr) { if (!cpu_addr) {
return {}; return false;
} }
const std::size_t page{(*cpu_addr & Core::Memory::PAGE_MASK) + size}; const std::size_t page{(*cpu_addr & Core::Memory::PAGE_MASK) + size};
return page <= Core::Memory::PAGE_SIZE; return page <= Core::Memory::PAGE_SIZE;
......
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
/** /**
* IsGranularRange checks if a gpu region can be simply read with a pointer. * IsGranularRange checks if a gpu region can be simply read with a pointer.
*/ */
bool IsGranularRange(GPUVAddr gpu_addr, std::size_t size); bool IsGranularRange(GPUVAddr gpu_addr, std::size_t size) const;
GPUVAddr Map(VAddr cpu_addr, GPUVAddr gpu_addr, std::size_t size); GPUVAddr Map(VAddr cpu_addr, GPUVAddr gpu_addr, std::size_t size);
GPUVAddr MapAllocate(VAddr cpu_addr, std::size_t size, std::size_t align); GPUVAddr MapAllocate(VAddr cpu_addr, std::size_t size, std::size_t align);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment