mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18:30 +00:00
Perform some code cleanup
This commit is contained in:
parent
cc1732bc42
commit
210187cf77
205 changed files with 1748 additions and 2595 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue