Changeset 30380 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Feb 18, 2008, 1:28:21 PM (17 years ago)
Author:
Darin Adler
Message:

Reviewed by Sam.

  • wtf/ASCIICType.h: (WTF::toASCIIHexValue): Added.
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r30356 r30380  
     12008-02-18  Darin Adler  <[email protected]>
     2
     3        Reviewed by Sam.
     4
     5        * wtf/ASCIICType.h:
     6        (WTF::toASCIIHexValue): Added.
     7
    182008-02-17  Darin Adler  <[email protected]>
    29
  • trunk/JavaScriptCore/wtf/ASCIICType.h

    r30177 r30380  
    8787
    8888    /*
    89         Statistics from a run of the PLT on the usage of isASCIISpace:
    90         Hex  Name               Count
    91         ---  ----               -----
    92            ALL OTHER VALUES     689383
    93         x20  SPACE              294720
    94         x0A  NEWLINE            89059
    95         x09  TAB                28320
    96         x0D  CARRIAGE RETURN    0
    97         x0C  FORMFEED           0
    98         x0B  VERTICAL TAB       0
     89        Statistics from a run of Apple's page load test for callers of isASCIISpace:
    9990
     91            character          count
     92            ---------          -----
     93            non-spaces         689383
     94        20  space              294720
     95        0A  \n                 89059
     96        09  \t                 28320
     97        0D  \r                 0
     98        0C  \f                 0
     99        0B  \v                 0
    100100    */
    101 
    102101    inline bool isASCIISpace(char c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
    103102    inline bool isASCIISpace(unsigned short c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
     
    121120    inline int toASCIIUpper(int c) { return static_cast<int>(c & ~((c >= 'a' && c <= 'z') << 5)); }
    122121
     122    inline int toASCIIHexValue(char c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
     123    inline int toASCIIHexValue(unsigned short c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
     124#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
     125    inline int toASCIIHexValue(wchar_t c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
     126#endif
     127    inline int toASCIIHexValue(int c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
     128
    123129}
    124130
Note: See TracChangeset for help on using the changeset viewer.