Str2I64: allow single "+" or "-" prefix before number

This commit is contained in:
Michael Mikonos 2023-10-23 16:20:49 +08:00
parent cf73aa2029
commit 6104f8b905

View file

@ -13,18 +13,16 @@ I64 Str2I64(U8 *st, I64 radix=10, U8 **_end_ptr=NULL)
} }
while (Bt(char_bmp_white_space, *st)) while (Bt(char_bmp_white_space, *st))
st++; st++;
if (*st == '+')
st++;
else if (*st == '-')
{
neg = TRUE;
st++;
}
while (TRUE) while (TRUE)
switch (*st) switch (*st)
{ {
case '-':
st++;
neg = !neg;
break;
case '+':
st++;
break;
case '0': case '0':
st++; st++;
ch = ToUpper(*st); ch = ToUpper(*st);