|
@@ -167,11 +167,14 @@ unsigned long strtoul ( const char *p, char **endp, int base ) {
|
167
|
167
|
}
|
168
|
168
|
|
169
|
169
|
while ( 1 ) {
|
170
|
|
- charval = ( *p - '0' );
|
171
|
|
- if ( charval > ( 'A' - '0' - 10 ) )
|
172
|
|
- charval -= ( 'A' - '0' - 10 );
|
173
|
|
- if ( charval > ( 'a' - 'A' ) )
|
174
|
|
- charval -= ( 'a' - 'A' );
|
|
170
|
+ charval = *p;
|
|
171
|
+ if ( charval >= 'a' ) {
|
|
172
|
+ charval = ( charval - 'a' + 10 );
|
|
173
|
+ } else if ( charval >= 'A' ) {
|
|
174
|
+ charval = ( charval - 'A' + 10 );
|
|
175
|
+ } else {
|
|
176
|
+ charval = ( charval - '0' );
|
|
177
|
+ }
|
175
|
178
|
if ( charval >= ( unsigned int ) base )
|
176
|
179
|
break;
|
177
|
180
|
ret = ( ( ret * base ) + charval );
|