Make more code aarch64 friendly

This commit is contained in:
Justine Tunney 2023-05-02 13:38:16 -07:00
parent ca2860947f
commit 2b73e72d59
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
568 changed files with 2197 additions and 1061 deletions

View file

@ -31,6 +31,7 @@ static inline const char *strchrnul_pure(const char *s, int c) {
}
}
#ifdef __x86_64__
noasan static inline const char *strchrnul_sse(const char *s, unsigned char c) {
unsigned k;
unsigned m;
@ -49,6 +50,7 @@ noasan static inline const char *strchrnul_sse(const char *s, unsigned char c) {
}
return (const char *)p + __builtin_ctzl(m);
}
#endif
/**
* Returns pointer to first instance of character.
@ -61,6 +63,7 @@ noasan static inline const char *strchrnul_sse(const char *s, unsigned char c) {
* NUL terminator if c is not found
*/
char *strchrnul(const char *s, int c) {
#ifdef __x86_64__
const char *r;
if (X86_HAVE(SSE)) {
if (IsAsan()) __asan_verify(s, 1);
@ -70,4 +73,7 @@ char *strchrnul(const char *s, int c) {
}
_unassert((*r & 255) == (c & 255) || !*r);
return (char *)r;
#else
return strchrnul_pure(s, c);
#endif
}