3 ms·
Of course, most actual strchr implementations tend to be heavily vectorized hand-tuned assembly with macros to select the correct streaming extension supported
by saagarjha 8y ago
Of course, most actual strchr implementations tend to be heavily vectorized hand-tuned assembly with macros to select the correct streaming extension supported by the hardware. Or, for less powerful systems, something like
char *strchr(const char *s, int ch) {
char *p = s;
while (*p && *p != chr);
return p;
}
- kazinator 8y agos/less powerful systems/systems with lesser compilers/ With TCO, I'd expect the same code from the recursive version. The recursive version has the benefit of being pure; it doesn't mutate anything. Speaking of which, HN ate your ++.