Changeset 39246 in vbox
- Timestamp:
- Nov 9, 2011 10:25:42 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/ctype.h
r36573 r39246 65 65 DECL_FORCE_INLINE(bool) RTLocCIsBlank(int ch) 66 66 { 67 return ch == ' ' || ch == '\t'; 67 return ch == 0x20 /* space */ 68 || ch == 0x09; /* horizontal tab */ 68 69 } 69 70 … … 76 77 DECL_FORCE_INLINE(bool) RTLocCIsCntrl(int ch) 77 78 { 78 return (ch) >= 0 && (ch) < 32; 79 return (unsigned)ch < 32U /* 0..2f */ 80 || ch == 0x7f; 79 81 } 80 82 … … 87 89 DECL_FORCE_INLINE(bool) RTLocCIsDigit(int ch) 88 90 { 89 return ( ch) >= '0' && (ch) <= '9';91 return (unsigned)ch - 0x30 < 10U; /* 30..39 */ 90 92 } 91 93 … … 98 100 DECL_FORCE_INLINE(bool) RTLocCIsLower(int ch) 99 101 { 100 return ( ch) >= 'a' && (ch) <= 'z';102 return (unsigned)ch - 0x61U < 26U; /* 61..7a */ 101 103 } 102 104 … … 109 111 DECL_FORCE_INLINE(bool) RTLocCIsODigit(int ch) 110 112 { 111 return ( ch) >= '0' && (ch) <= '7';113 return (unsigned)ch - 0x30 < 8U; /* 30..37 */ 112 114 } 113 115 … … 120 122 DECL_FORCE_INLINE(bool) RTLocCIsPrint(int ch) 121 123 { 122 /** @todo quite possibly incorrect */ 123 return (ch) >= 32 && (ch) < 127; 124 return (unsigned)ch - 0x20U < 95U; /* 20..7e */ 124 125 } 125 126 … … 132 133 DECL_FORCE_INLINE(bool) RTLocCIsPunct(int ch) 133 134 { 134 /** @todo possibly incorrect */ 135 return (ch) == ',' || (ch) == '.' || (ch) == ':' || (ch) == ';' || (ch) == '!' || (ch) == '?'; 135 return (unsigned)ch - 0x21U < 15U /* 21..2f */ 136 || (unsigned)ch - 0x2aU < 6U /* 2a..2f */ 137 || (unsigned)ch - 0x3aU < 7U /* 3a..40 */ 138 || (unsigned)ch - 0x5bU < 6U /* 5a..60 */ 139 || (unsigned)ch - 0x7bU < 4U /* 7b..7e */; 136 140 } 137 141 … … 144 148 DECL_FORCE_INLINE(bool) RTLocCIsSpace(int ch) 145 149 { 146 /* \t (9), \n (10), \v (11), \f (12), \r (13), ' ' (32).*/147 return (ch) == ' ' || ((ch) >= 9 && (ch) <= 13);150 return ch == 0x20 /* 20 (space) */ 151 || (unsigned)ch - 0x09U < 5U; /* 09..0d */ 148 152 } 149 153 … … 156 160 DECL_FORCE_INLINE(bool) RTLocCIsUpper(int ch) 157 161 { 158 return ( ch) >= 'A' && (ch) <= 'Z';162 return (unsigned)ch - 0x41 < 26U; /* 41..5a */ 159 163 } 160 164 … … 167 171 DECL_FORCE_INLINE(bool) RTLocCIsXDigit(int ch) 168 172 { 169 return RTLocCIsDigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || ((ch) >= 'A' && (ch) <= 'F'); 173 return (unsigned)ch - 0x30 < 10U /* 30..39 (0-9) */ 174 || (unsigned)ch - 0x41 < 6 /* 41..46 (A-F) */ 175 || (unsigned)ch - 0x61 < 6; /* 61..66 (a-f) */ 170 176 } 171 177 … … 212 218 DECL_FORCE_INLINE(int) RTLocCToLower(int ch) 213 219 { 214 return RTLocCIsUpper(ch) ? (ch) + ('a' - 'A'): (ch);220 return RTLocCIsUpper(ch) ? (ch) + 0x20 : (ch); 215 221 } 216 222 … … 223 229 DECL_FORCE_INLINE(int) RTLocCToUpper(int ch) 224 230 { 225 return RTLocCIsLower(ch) ? (ch) - ('a' - 'A'): (ch);231 return RTLocCIsLower(ch) ? (ch) - 0x20 : (ch); 226 232 } 227 233 -
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r39027 r39246 51 51 tstRTCidr \ 52 52 tstRTCritSect \ 53 tstRTCType \ 53 54 tstRTDigest \ 54 55 tstDir \ … … 209 210 tstRTCritSectW32_DEFS = TRY_WIN32_CRIT 210 211 212 tstRTCType_TEMPLATE = VBOXR3TSTEXE 213 tstRTCType_SOURCES = tstRTCType.cpp 214 211 215 tstRTDigest_SOURCES = tstRTDigest.cpp 212 216
Note:
See TracChangeset
for help on using the changeset viewer.