mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-13 10:07:58 -05:00
General: Make use of std::nullopt where applicable
Allows some implementations to avoid completely zeroing out the internal buffer of the optional, and instead only set the validity byte within the structure. This also makes it consistent how we return empty optionals.
This commit is contained in:
@ -58,7 +58,7 @@ void MemoryManager::Unmap(GPUVAddr gpu_addr, std::size_t size) {
|
||||
std::optional<GPUVAddr> MemoryManager::AllocateFixed(GPUVAddr gpu_addr, std::size_t size) {
|
||||
for (u64 offset{}; offset < size; offset += page_size) {
|
||||
if (!GetPageEntry(gpu_addr + offset).IsUnmapped()) {
|
||||
return {};
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,13 +135,13 @@ std::optional<GPUVAddr> MemoryManager::FindFreeRange(std::size_t size, std::size
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) const {
|
||||
const auto page_entry{GetPageEntry(gpu_addr)};
|
||||
if (!page_entry.IsValid()) {
|
||||
return {};
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return page_entry.ToAddress() + (gpu_addr & page_mask);
|
||||
|
Reference in New Issue
Block a user