Prefer static const std::regex

std::regex has a relatively expensive constructor, and these are unchanging regexes.
This commit is contained in:
get
2023-06-07 20:07:54 -05:00
parent 44d93048b3
commit 1df482d51f
3 changed files with 11 additions and 8 deletions

View File

@ -443,7 +443,7 @@ std::string PPCDebugInterface::GetDescription(u32 address) const
std::optional<u32>
PPCDebugInterface::GetMemoryAddressFromInstruction(const std::string& instruction) const
{
std::regex re(",[^r0-]*(-?)(0[xX]?[0-9a-fA-F]*|r\\d+)[^r^s]*.(p|toc|\\d+)");
static const std::regex re(",[^r0-]*(-?)(0[xX]?[0-9a-fA-F]*|r\\d+)[^r^s]*.(p|toc|\\d+)");
std::smatch match;
// Instructions should be identified as a load or store before using this function. This error