Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
745 B

/*++
Copyright (c) 1988-1999 Microsoft Corporation
Module Name:
hstoi.c
Abstract:
Low level utility
--*/
#include "cmd.h"
/*** hstoi - convert a hex string to an integer
*
* Conversion stops when the first non-hex character is found. If the first
* character is not a hex character, 0 is returned.
*
* Eric K. Evans, Microsoft
*/
hstoi( TCHAR *s )
{
int result = 0 ;
int digit ;
if (s == NULL) {
return 0;
}
s = SkipWhiteSpace( s );
for ( ; *s && _istxdigit(*s) ; s++) {
digit = (int) (*s <= TEXT('9')) ? (int)*s - (int)'0' : (int)_totlower(*s)-(int)'W' ;
result = (result << 4)+digit ;
} ;
return (result) ;
}