mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-10-30 15:39:02 -05:00 
			
		
		
		
	kernel/vm_manager: Convert loop into std::any_of()
This commit is contained in:
		| @@ -2,6 +2,7 @@ | ||||
| // Licensed under GPLv2 or any later version | ||||
| // Refer to the license.txt file included. | ||||
|  | ||||
| #include <algorithm> | ||||
| #include <iterator> | ||||
| #include <utility> | ||||
| #include "common/assert.h" | ||||
| @@ -295,10 +296,9 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMARange(VAddr target, u64 size) { | ||||
|  | ||||
|     VMAIter begin_vma = StripIterConstness(FindVMA(target)); | ||||
|     const VMAIter i_end = vma_map.lower_bound(target_end); | ||||
|     for (auto i = begin_vma; i != i_end; ++i) { | ||||
|         if (i->second.type == VMAType::Free) { | ||||
|             return ERR_INVALID_ADDRESS_STATE; | ||||
|         } | ||||
|     if (std::any_of(begin_vma, i_end, | ||||
|                     [](const auto& entry) { return entry.second.type == VMAType::Free; })) { | ||||
|         return ERR_INVALID_ADDRESS_STATE; | ||||
|     } | ||||
|  | ||||
|     if (target != begin_vma->second.base) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Lioncash
					Lioncash