X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstring%2Fstrlen.c;h=309990f029f0c09b4c7c0405258b92ac8f93310d;hb=0ab97350f01b42de0f9fd811ee08653169661859;hp=d6f8631d59dd1ba47334d955fc1fe6e94106dcf3;hpb=3f9ff1514e49b06c20a61af9ae9e52bd53b48d9a;p=musl diff --git a/src/string/strlen.c b/src/string/strlen.c index d6f8631d..309990f0 100644 --- a/src/string/strlen.c +++ b/src/string/strlen.c @@ -1,5 +1,4 @@ #include -#include #include #include @@ -11,9 +10,13 @@ size_t strlen(const char *s) { const char *a = s; - const size_t *w; +#ifdef __GNUC__ + typedef size_t __attribute__((__may_alias__)) word; + const word *w; for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a; for (w = (const void *)s; !HASZERO(*w); w++); - for (s = (const void *)w; *s; s++); + s = (const void *)w; +#endif + for (; *s; s++); return s-a; }