Merge pull request #1225 from brian-peloton/master

Speed up printing of characters which need hex escaping
This commit is contained in:
Gennadiy Civil 2017-12-05 17:19:23 -05:00 committed by GitHub
commit a868e618c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,7 +180,10 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) {
*os << static_cast<char>(c); *os << static_cast<char>(c);
return kAsIs; return kAsIs;
} else { } else {
*os << "\\x" + String::FormatHexInt(static_cast<UnsignedChar>(c)); ostream::fmtflags flags = os->flags();
*os << "\\x" << std::hex << std::uppercase
<< static_cast<int>(static_cast<UnsignedChar>(c));
os->flags(flags);
return kHexEscape; return kHexEscape;
} }
} }