mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
[Config] Use std::less<> for std::map<...>
Reduces amount of string copies [Utilities] fmt::replace_all: avoid creation of temporary strings
This commit is contained in:
parent
2981867375
commit
cccfb89aa0
14 changed files with 80 additions and 62 deletions
|
|
@ -139,7 +139,7 @@ std::string CgBinaryDisasm::GetCondDisAsm() const
|
|||
|
||||
std::string CgBinaryDisasm::FormatDisAsm(const std::string& code)
|
||||
{
|
||||
const std::pair<std::string, std::function<std::string()>> repl_list[] =
|
||||
const std::pair<std::string_view, std::function<std::string()>> repl_list[] =
|
||||
{
|
||||
{ "$$", []() -> std::string { return "$"; } },
|
||||
{ "$0", [this]{ return GetSrcDisAsm<SRC0>(src0); } },
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ std::string CgBinaryDisasm::GetTexDisasm()
|
|||
|
||||
std::string CgBinaryDisasm::FormatDisasm(const std::string& code)
|
||||
{
|
||||
const std::pair<std::string, std::function<std::string()>> repl_list[] =
|
||||
const std::pair<std::string_view, std::function<std::string()>> repl_list[] =
|
||||
{
|
||||
{ "$$", []() -> std::string { return "$"; } },
|
||||
{ "$0", [this]{ return GetSRCDisasm(0); } },
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ bool FragmentProgramDecompiler::DstExpectsSca() const
|
|||
|
||||
std::string FragmentProgramDecompiler::Format(const std::string& code, bool ignore_redirects)
|
||||
{
|
||||
const std::pair<std::string, std::function<std::string()>> repl_list[] =
|
||||
const std::pair<std::string_view, std::function<std::string()>> repl_list[] =
|
||||
{
|
||||
{ "$$", []() -> std::string { return "$"; } },
|
||||
{ "$0", [this]() -> std::string {return GetSRC<SRC0>(src0);} },
|
||||
|
|
@ -369,7 +369,7 @@ std::string FragmentProgramDecompiler::Format(const std::string& code, bool igno
|
|||
{
|
||||
//Redirect parameter 0 to the x2d temp register for TEXBEM
|
||||
//TODO: Organize this a little better
|
||||
std::pair<std::string, std::string> repl[] = { { "$0", "x2d" } };
|
||||
std::pair<std::string_view, std::string> repl[] = { { "$0", "x2d" } };
|
||||
std::string result = fmt::replace_all(code, repl);
|
||||
|
||||
return fmt::replace_all(result, repl_list);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ namespace program_common
|
|||
" return result;\n"
|
||||
"}\n\n";
|
||||
|
||||
std::pair<std::string, std::string> replacements[] =
|
||||
std::pair<std::string_view, std::string> replacements[] =
|
||||
{std::make_pair("$T", wide_vector_type),
|
||||
std::make_pair("$I", input_coord)};
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ std::string VertexProgramDecompiler::GetTex()
|
|||
|
||||
std::string VertexProgramDecompiler::Format(const std::string& code)
|
||||
{
|
||||
const std::pair<std::string, std::function<std::string()>> repl_list[] =
|
||||
const std::pair<std::string_view, std::function<std::string()>> repl_list[] =
|
||||
{
|
||||
{ "$$", []() -> std::string { return "$"; } },
|
||||
{ "$0", std::bind(std::mem_fn(&VertexProgramDecompiler::GetSRC), this, 0) },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue