tim wrote: > No <wink>. But if someone does, a good compromise might be to split = this > into two loops, one for the n=3D=3D1 case and another for n>1. how about this one: if (dir > 0) { char *p, *e; if (n =3D=3D 0 && i <=3D last) return (long)i; e =3D s + last - n + 1; for (;;) { p =3D memchr(s, sub[0], e - s); if (p =3D=3D NULL) break; if (n =3D=3D 1 || memcmp(p, sub, n) =3D=3D 0) return (long) (p - s); s =3D p + 1; } } new record time: 1.6 seconds (down from 2.2) </F>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4