diff options
| author | 2020-07-13 10:35:22 -0400 | |
|---|---|---|
| committer | 2020-07-13 10:42:52 -0400 | |
| commit | ed0fe04b4f8a681885adaa7ad2074fbcdab1956a (patch) | |
| tree | ca51bbfdede0f681a019f883ff66386282d6401d | |
| parent | address_space_info: Make use of designated initializers (diff) | |
| download | yuzu-ed0fe04b4f8a681885adaa7ad2074fbcdab1956a.tar.gz yuzu-ed0fe04b4f8a681885adaa7ad2074fbcdab1956a.tar.xz yuzu-ed0fe04b4f8a681885adaa7ad2074fbcdab1956a.zip | |
address_space_info: Use type alias to simplify code
We can define an alias for the index arrays and then just reuse it to
make the code nicer to read.
| -rw-r--r-- | src/core/hle/kernel/memory/address_space_info.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/core/hle/kernel/memory/address_space_info.cpp b/src/core/hle/kernel/memory/address_space_info.cpp index 6f7f1614b..e4288cab4 100644 --- a/src/core/hle/kernel/memory/address_space_info.cpp +++ b/src/core/hle/kernel/memory/address_space_info.cpp | |||
| @@ -49,20 +49,19 @@ constexpr bool IsAllowedIndexForAddress(std::size_t index) { | |||
| 49 | return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Invalid; | 49 | return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Invalid; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | constexpr std::array<std::size_t, static_cast<std::size_t>(AddressSpaceInfo::Type::Count)> | 52 | using IndexArray = std::array<std::size_t, static_cast<std::size_t>(AddressSpaceInfo::Type::Count)>; |
| 53 | AddressSpaceIndices32Bit{ | 53 | |
| 54 | 0, 1, 0, 2, 0, 3, | 54 | constexpr IndexArray AddressSpaceIndices32Bit{ |
| 55 | }; | 55 | 0, 1, 0, 2, 0, 3, |
| 56 | 56 | }; | |
| 57 | constexpr std::array<std::size_t, static_cast<std::size_t>(AddressSpaceInfo::Type::Count)> | 57 | |
| 58 | AddressSpaceIndices36Bit{ | 58 | constexpr IndexArray AddressSpaceIndices36Bit{ |
| 59 | 4, 5, 4, 6, 4, 7, | 59 | 4, 5, 4, 6, 4, 7, |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | constexpr std::array<std::size_t, static_cast<std::size_t>(AddressSpaceInfo::Type::Count)> | 62 | constexpr IndexArray AddressSpaceIndices39Bit{ |
| 63 | AddressSpaceIndices39Bit{ | 63 | 9, 8, 8, 10, 12, 11, |
| 64 | 9, 8, 8, 10, 12, 11, | 64 | }; |
| 65 | }; | ||
| 66 | 65 | ||
| 67 | constexpr bool IsAllowed32BitType(AddressSpaceInfo::Type type) { | 66 | constexpr bool IsAllowed32BitType(AddressSpaceInfo::Type type) { |
| 68 | return type < AddressSpaceInfo::Type::Count && type != AddressSpaceInfo::Type::Large64Bit && | 67 | return type < AddressSpaceInfo::Type::Count && type != AddressSpaceInfo::Type::Large64Bit && |