projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
math: move x87-family fmod functions to C with inline asm
[musl]
/
src
/
string
/
strlen.c
diff --git
a/src/string/strlen.c
b/src/string/strlen.c
index
929ddcb
..
309990f
100644
(file)
--- a/
src/string/strlen.c
+++ b/
src/string/strlen.c
@@
-10,9
+10,13
@@
size_t strlen(const char *s)
{
const char *a = s;
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 (; (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;
}
return s-a;
}