下面源码改自 Windows Kits 10.0.22000.0 #include
#include
enum
{
FL_SIGNED = 0x01,
FL_NEGATIVE = 0x02,
FL_OVERFLOW = 0x04,
FL_READ_DIGIT = 0x08
};
unsigned int parse_digit(const char c)
{
if (c >= '0' && c = 'a' && c = 'A' && c (unsigned int)(-LONG_MIN))
return TRUE;
if ((flags & FL_NEGATIVE) == 0 && number > (unsigned int)(LONG_MAX))
return TRUE;
}
return FALSE;
}
unsigned int parse_integer(const char* source, int base, const BOOL is_result_signed)
{
if (source == 0)
return 0;
assert(base == 0 || (2 max_pre_multiply_value) | (number_after_add |