I don't think that it is true that "(signed char)(*p) >= 0" is always true, otherwise all of the "else if" branches would never be taken. I think the optimization that PMHager was thinking about (based on what I see in the x86_64 assembly from gcc) is that the compiler could (but apparently not every compiler does this) use the instruction for checking the sign, like this: 9: 84 c9 test %cl,%cl b: 78 1b js 28 <UTF8_getc+0x28> This is most likely faster than having to do a logical and instruction first.
To get back to Michel's question, I think he has a point, but where can we find regression tests for a_utf8.c to be sure? I added an error on purpose, but didn't see any errors when I ran "make test".