Perform some code cleanup

This commit is contained in:
Justine Tunney 2023-05-15 16:32:10 -07:00
parent cc1732bc42
commit 210187cf77
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
205 changed files with 1748 additions and 2595 deletions

View file

@ -38,7 +38,7 @@ noasan size_t strlen(const char *s) {
m = __builtin_ia32_pmovmskb128(*p == z) >> k << k;
while (!m) m = __builtin_ia32_pmovmskb128(*++p == z);
return (const char *)p + __builtin_ctzl(m) - s;
#elif defined(__GNUC__) || defined(__llvm__)
#else
#define ONES ((word)-1 / 255)
#define BANE (ONES * (255 / 2 + 1))
typedef unsigned long mayalias word;
@ -56,10 +56,6 @@ noasan size_t strlen(const char *s) {
w = ~w & (w - ONES) & BANE;
}
return (const char *)p + (__builtin_ctzl(w) >> 3) - s;
#else
size_t n = 0;
while (*s++) ++n;
return n;
#endif
}