Portable the lookup table will be probably the fastest. For a specific encoding (for example ASCII) some char arithmetic.
const char table[256] = {
['a'] = 'a', ['A'] = 'a',
['b'] = 'b', ['B'] = 'b',
['c'] = 'c', ['C'] = 'c',
['d'] = 'd', ['D'] = 'd',
['e'] = 'e', ['E'] = 'e',
['f'] = 'f', ['f'] = 'f',
['g'] = 'g', ['g'] = 'g',
['h'] = 'h', ['H'] = 'h',
['i'] = 'i', ['I'] = 'i',
['j'] = 'j', ['J'] = 'j',
/* etc etc */
};
char *strl_p(char *str)
{
char c;
char *saved = str;
unsigned char *ustr = str;
while(*ustr)
{
c = table[*ustr];
if(c) *ustr = c;
ustr++;
}
return saved;
}
char *strl_ascii(char *str)
{
char c;
char *saved = str;
while(*str)
{
c = *str;
if(c >= 'A' && c <= 'Z') *str = c - ('A' - 'a');
str++;
}
return saved;
}