Just yesterday i completed an optimized version of 'strlen' by using inline assembly. The problem is that although it's much faster than the typical approach:
when compared to the standard library's function it sucks!!!! I'm comparing bytes as fast as i can, while maintaining legacy support of course. The only way that the library could overrun mine would be by using MMX or better yet SSE-SSE2 instructions. But wouldn't that make the library incompatible with old x86 CPUs? It doesn't make sense!!!Code:int i; while (*str++ != '\0') ++i; return i;
EDIT: Even CodeBlocks at -O3 and with Core2 instructions enabled hesitates to use them!!