In a custom library I saw an implementation:
inline int is_upper_alpha(char chValue)
{
if (((chValue >= 'A') && (chValue <= 'I')) ||
((chValue >= 'J') && (chValue <= 'R')) ||
((chValue >= 'S') && (chValue <= 'Z')))
return 1;
return 0;
}
Is that an Easter egg or what are the advantages vs standard C/C++ method?
inline int is_upper_alpha(char chValue)
{
return ((chValue >= 'A') && (chValue <= 'Z'));
}
'J' - 'I'
and'S' - 'R'
both equal1
, then I expect that a reasonable optimizer would turn the former in the latter. – Lecroy