On Mon, 21 Jan 2008, Linus Torvalds wrote:
First off, the common case is that the filename likely has everything in
plain 7-bit ascii. So rather than re-encoding by default, the first thing
to do is to just see if it even needs re-encoding. Even if it's as simple
as saying "does it have any high bits at all", that's going to be a *huge*
performance win.
So start off with something like
int is_usascii(const char *p)
{
char c;
do {
c = *p++;
} while (c > 0);
return !c;
}
You need to use "signed char" here. On ARM a char is unsigned by
default. That's the case on some other systems too.
Nicolas