diff options
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 018000abd..80a34c2d5 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 6 | |||
| 5 | #include "common/common.h" | 7 | #include "common/common.h" |
| 6 | 8 | ||
| 7 | #include "core/core.h" | 9 | #include "core/core.h" |
| @@ -37,7 +39,7 @@ Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) { | |||
| 37 | return 0; | 39 | return 0; |
| 38 | } | 40 | } |
| 39 | 41 | ||
| 40 | bool ObjectPool::IsValid(Handle handle) { | 42 | bool ObjectPool::IsValid(Handle handle) const { |
| 41 | int index = handle - HANDLE_OFFSET; | 43 | int index = handle - HANDLE_OFFSET; |
| 42 | if (index < 0) | 44 | if (index < 0) |
| 43 | return false; | 45 | return false; |
| @@ -75,13 +77,8 @@ void ObjectPool::List() { | |||
| 75 | } | 77 | } |
| 76 | } | 78 | } |
| 77 | 79 | ||
| 78 | int ObjectPool::GetCount() { | 80 | int ObjectPool::GetCount() const { |
| 79 | int count = 0; | 81 | return std::count(occupied.begin(), occupied.end(), true); |
| 80 | for (int i = 0; i < MAX_COUNT; i++) { | ||
| 81 | if (occupied[i]) | ||
| 82 | count++; | ||
| 83 | } | ||
| 84 | return count; | ||
| 85 | } | 82 | } |
| 86 | 83 | ||
| 87 | Object* ObjectPool::CreateByIDType(int type) { | 84 | Object* ObjectPool::CreateByIDType(int type) { |