optimized hex digit verification a little
This commit is contained in:
parent
ec9afe9c33
commit
3ef067f6d1
|
@ -1917,11 +1917,15 @@ stdstr CCheats::ReadOptionsString(HWND hDlg, bool &/*validcodes*/, bool &validop
|
||||||
|
|
||||||
int is_valid_hex_digit(char symbol)
|
int is_valid_hex_digit(char symbol)
|
||||||
{
|
{
|
||||||
if (
|
if (symbol < '0')
|
||||||
((symbol >= 'a') && (symbol <= 'f'))
|
return 0; /* no valid hex figures before '0' */
|
||||||
|| ((symbol >= 'A') && (symbol <= 'F'))
|
if (symbol <= '9')
|
||||||
|| ((symbol >= '0') && (symbol <= '9'))
|
return 1;
|
||||||
)
|
|
||||||
|
symbol &= ~0x20; /* in ASCII, forces lowercase to uppercase */
|
||||||
|
if (symbol < 'A')
|
||||||
|
return 0;
|
||||||
|
if (symbol <= 'Z')
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue