Optimize string comparisons by avoiding the creation of temporary substrings.
TRAC #16567
Bug=136
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/trunk@761 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index 3eb9a07..9b47aac 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -2342,7 +2342,7 @@
TString OutputHLSL::decorate(const TString &string)
{
- if (string.substr(0, 3) != "gl_" && string.substr(0, 3) != "dx_")
+ if (string.compare(0, 3, "gl_") != 0 && string.compare(0, 3, "dx_") != 0)
{
return "_" + string;
}