| Index: third_party/WebKit/Source/wtf/ASCIICType.h
|
| diff --git a/third_party/WebKit/Source/wtf/ASCIICType.h b/third_party/WebKit/Source/wtf/ASCIICType.h
|
| index 052a45b11c3c65a6b695bea7a052a58f35484554..d990cbead6cbbcf4ff9045d4500edb92ee47ef36 100644
|
| --- a/third_party/WebKit/Source/wtf/ASCIICType.h
|
| +++ b/third_party/WebKit/Source/wtf/ASCIICType.h
|
| @@ -44,44 +44,44 @@
|
|
|
| namespace WTF {
|
|
|
| -template<typename CharType> inline bool isASCII(CharType c)
|
| -{
|
| - return !(c & ~0x7F);
|
| +template <typename CharType>
|
| +inline bool isASCII(CharType c) {
|
| + return !(c & ~0x7F);
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIIAlpha(CharType c)
|
| -{
|
| - return (c | 0x20) >= 'a' && (c | 0x20) <= 'z';
|
| +template <typename CharType>
|
| +inline bool isASCIIAlpha(CharType c) {
|
| + return (c | 0x20) >= 'a' && (c | 0x20) <= 'z';
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIIDigit(CharType c)
|
| -{
|
| - return c >= '0' && c <= '9';
|
| +template <typename CharType>
|
| +inline bool isASCIIDigit(CharType c) {
|
| + return c >= '0' && c <= '9';
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIIAlphanumeric(CharType c)
|
| -{
|
| - return isASCIIDigit(c) || isASCIIAlpha(c);
|
| +template <typename CharType>
|
| +inline bool isASCIIAlphanumeric(CharType c) {
|
| + return isASCIIDigit(c) || isASCIIAlpha(c);
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIIHexDigit(CharType c)
|
| -{
|
| - return isASCIIDigit(c) || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f');
|
| +template <typename CharType>
|
| +inline bool isASCIIHexDigit(CharType c) {
|
| + return isASCIIDigit(c) || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f');
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIILower(CharType c)
|
| -{
|
| - return c >= 'a' && c <= 'z';
|
| +template <typename CharType>
|
| +inline bool isASCIILower(CharType c) {
|
| + return c >= 'a' && c <= 'z';
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIIOctalDigit(CharType c)
|
| -{
|
| - return (c >= '0') & (c <= '7');
|
| +template <typename CharType>
|
| +inline bool isASCIIOctalDigit(CharType c) {
|
| + return (c >= '0') & (c <= '7');
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIIPrintable(CharType c)
|
| -{
|
| - return c >= ' ' && c <= '~';
|
| +template <typename CharType>
|
| +inline bool isASCIIPrintable(CharType c) {
|
| + return c >= ' ' && c <= '~';
|
| }
|
|
|
| /*
|
| @@ -97,85 +97,81 @@ template<typename CharType> inline bool isASCIIPrintable(CharType c)
|
| 0C \f 0
|
| 0B \v 0
|
| */
|
| -template<typename CharType> inline bool isASCIISpace(CharType c)
|
| -{
|
| - return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9));
|
| +template <typename CharType>
|
| +inline bool isASCIISpace(CharType c) {
|
| + return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9));
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIIUpper(CharType c)
|
| -{
|
| - return c >= 'A' && c <= 'Z';
|
| +template <typename CharType>
|
| +inline bool isASCIIUpper(CharType c) {
|
| + return c >= 'A' && c <= 'Z';
|
| }
|
|
|
| WTF_EXPORT extern const LChar ASCIICaseFoldTable[256];
|
|
|
| -template<typename CharType> inline CharType toASCIILower(CharType c)
|
| -{
|
| +template <typename CharType>
|
| +inline CharType toASCIILower(CharType c) {
|
| #if defined(_MSC_FULL_VER) && _MSC_FULL_VER == 170060610
|
| - // Make a workaround for VS2012 update 3 optimizer bug, remove once VS2012 fix it.
|
| - return (c >= 'A' && c <= 'Z') ? c + 0x20 : c;
|
| + // Make a workaround for VS2012 update 3 optimizer bug, remove once VS2012 fix it.
|
| + return (c >= 'A' && c <= 'Z') ? c + 0x20 : c;
|
| #else
|
| - return c | ((c >= 'A' && c <= 'Z') << 5);
|
| + return c | ((c >= 'A' && c <= 'Z') << 5);
|
| #endif
|
| }
|
|
|
| -inline LChar toASCIILower(LChar c)
|
| -{
|
| - return ASCIICaseFoldTable[c];
|
| +inline LChar toASCIILower(LChar c) {
|
| + return ASCIICaseFoldTable[c];
|
| }
|
|
|
| -inline char toASCIILower(char c)
|
| -{
|
| - return static_cast<char>(ASCIICaseFoldTable[static_cast<LChar>(c)]);
|
| +inline char toASCIILower(char c) {
|
| + return static_cast<char>(ASCIICaseFoldTable[static_cast<LChar>(c)]);
|
| }
|
|
|
| -template<typename CharType> inline CharType toASCIILowerUnchecked(CharType character)
|
| -{
|
| - // This function can be used for comparing any input character
|
| - // to a lowercase English character. The isASCIIAlphaCaselessEqual
|
| - // below should be used for regular comparison of ASCII alpha
|
| - // characters, but switch statements in CSS tokenizer require
|
| - // direct use of this function.
|
| - return character | 0x20;
|
| +template <typename CharType>
|
| +inline CharType toASCIILowerUnchecked(CharType character) {
|
| + // This function can be used for comparing any input character
|
| + // to a lowercase English character. The isASCIIAlphaCaselessEqual
|
| + // below should be used for regular comparison of ASCII alpha
|
| + // characters, but switch statements in CSS tokenizer require
|
| + // direct use of this function.
|
| + return character | 0x20;
|
| }
|
|
|
| -template<typename CharType> inline CharType toASCIIUpper(CharType c)
|
| -{
|
| - return c & ~((c >= 'a' && c <= 'z') << 5);
|
| +template <typename CharType>
|
| +inline CharType toASCIIUpper(CharType c) {
|
| + return c & ~((c >= 'a' && c <= 'z') << 5);
|
| }
|
|
|
| -template<typename CharType> inline int toASCIIHexValue(CharType c)
|
| -{
|
| - ASSERT(isASCIIHexDigit(c));
|
| - return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF;
|
| +template <typename CharType>
|
| +inline int toASCIIHexValue(CharType c) {
|
| + ASSERT(isASCIIHexDigit(c));
|
| + return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF;
|
| }
|
|
|
| -template<typename CharType> inline int toASCIIHexValue(CharType upperValue, CharType lowerValue)
|
| -{
|
| - ASSERT(isASCIIHexDigit(upperValue) && isASCIIHexDigit(lowerValue));
|
| - return ((toASCIIHexValue(upperValue) << 4) & 0xF0) | toASCIIHexValue(lowerValue);
|
| +template <typename CharType>
|
| +inline int toASCIIHexValue(CharType upperValue, CharType lowerValue) {
|
| + ASSERT(isASCIIHexDigit(upperValue) && isASCIIHexDigit(lowerValue));
|
| + return ((toASCIIHexValue(upperValue) << 4) & 0xF0) |
|
| + toASCIIHexValue(lowerValue);
|
| }
|
|
|
| -inline char lowerNibbleToASCIIHexDigit(char c)
|
| -{
|
| - char nibble = c & 0xF;
|
| - return nibble < 10 ? '0' + nibble : 'A' + nibble - 10;
|
| +inline char lowerNibbleToASCIIHexDigit(char c) {
|
| + char nibble = c & 0xF;
|
| + return nibble < 10 ? '0' + nibble : 'A' + nibble - 10;
|
| }
|
|
|
| -inline char upperNibbleToASCIIHexDigit(char c)
|
| -{
|
| - char nibble = (c >> 4) & 0xF;
|
| - return nibble < 10 ? '0' + nibble : 'A' + nibble - 10;
|
| +inline char upperNibbleToASCIIHexDigit(char c) {
|
| + char nibble = (c >> 4) & 0xF;
|
| + return nibble < 10 ? '0' + nibble : 'A' + nibble - 10;
|
| }
|
|
|
| -template<typename CharType> inline bool isASCIIAlphaCaselessEqual(CharType cssCharacter, char character)
|
| -{
|
| - // This function compares a (preferrably) constant ASCII
|
| - // lowercase letter to any input character.
|
| - ASSERT(character >= 'a' && character <= 'z');
|
| - return LIKELY(toASCIILowerUnchecked(cssCharacter) == character);
|
| +template <typename CharType>
|
| +inline bool isASCIIAlphaCaselessEqual(CharType cssCharacter, char character) {
|
| + // This function compares a (preferrably) constant ASCII
|
| + // lowercase letter to any input character.
|
| + ASSERT(character >= 'a' && character <= 'z');
|
| + return LIKELY(toASCIILowerUnchecked(cssCharacter) == character);
|
| }
|
| -
|
| }
|
|
|
| using WTF::isASCII;
|
|
|