diff options
| author | 2023-02-11 13:28:03 -0500 | |
|---|---|---|
| committer | 2023-02-14 12:33:11 -0500 | |
| commit | 45e13b03f372230dbf780f3fa87dd88f388af605 (patch) | |
| tree | 555593e7e5016b6ba2a777d7417ada244abce458 /src/core/file_sys | |
| parent | Merge pull request #9795 from Kelebek1/biquad_fix (diff) | |
| download | yuzu-45e13b03f372230dbf780f3fa87dd88f388af605.tar.gz yuzu-45e13b03f372230dbf780f3fa87dd88f388af605.tar.xz yuzu-45e13b03f372230dbf780f3fa87dd88f388af605.zip | |
add static lifetime to constexpr values to force compile time evaluation where possible
Signed-off-by: arades79 <scravers@protonmail.com>
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/ips_layer.cpp | 8 | ||||
| -rw-r--r-- | src/core/file_sys/program_metadata.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/core/file_sys/ips_layer.cpp b/src/core/file_sys/ips_layer.cpp index 5aab428bb..0a86e8b0a 100644 --- a/src/core/file_sys/ips_layer.cpp +++ b/src/core/file_sys/ips_layer.cpp | |||
| @@ -41,12 +41,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) { | |||
| 41 | return IPSFileType::Error; | 41 | return IPSFileType::Error; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | constexpr std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}}; | 44 | constexpr static std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}}; |
| 45 | if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) { | 45 | if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) { |
| 46 | return IPSFileType::IPS; | 46 | return IPSFileType::IPS; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | constexpr std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}}; | 49 | constexpr static std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}}; |
| 50 | if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) { | 50 | if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) { |
| 51 | return IPSFileType::IPS32; | 51 | return IPSFileType::IPS32; |
| 52 | } | 52 | } |
| @@ -55,12 +55,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) { | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static bool IsEOF(IPSFileType type, const std::vector<u8>& data) { | 57 | static bool IsEOF(IPSFileType type, const std::vector<u8>& data) { |
| 58 | constexpr std::array<u8, 3> eof{{'E', 'O', 'F'}}; | 58 | constexpr static std::array<u8, 3> eof{{'E', 'O', 'F'}}; |
| 59 | if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) { | 59 | if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) { |
| 60 | return true; | 60 | return true; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | constexpr std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}}; | 63 | constexpr static std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}}; |
| 64 | return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin()); | 64 | return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin()); |
| 65 | } | 65 | } |
| 66 | 66 | ||
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index f00479bd3..cb172f574 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp | |||
| @@ -97,7 +97,7 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) { | |||
| 97 | 97 | ||
| 98 | /*static*/ ProgramMetadata ProgramMetadata::GetDefault() { | 98 | /*static*/ ProgramMetadata ProgramMetadata::GetDefault() { |
| 99 | // Allow use of cores 0~3 and thread priorities 1~63. | 99 | // Allow use of cores 0~3 and thread priorities 1~63. |
| 100 | constexpr u32 default_thread_info_capability = 0x30007F7; | 100 | constexpr static u32 default_thread_info_capability = 0x30007F7; |
| 101 | 101 | ||
| 102 | ProgramMetadata result; | 102 | ProgramMetadata result; |
| 103 | 103 | ||
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 878d832c2..0f1f76949 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -71,7 +71,7 @@ static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bo | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | static std::string GetCNMTName(TitleType type, u64 title_id) { | 73 | static std::string GetCNMTName(TitleType type, u64 title_id) { |
| 74 | constexpr std::array<const char*, 9> TITLE_TYPE_NAMES{ | 74 | constexpr static std::array<const char*, 9> TITLE_TYPE_NAMES{ |
| 75 | "SystemProgram", | 75 | "SystemProgram", |
| 76 | "SystemData", | 76 | "SystemData", |
| 77 | "SystemUpdate", | 77 | "SystemUpdate", |