mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Make more code aarch64 friendly
This commit is contained in:
parent
ca2860947f
commit
2b73e72d59
568 changed files with 2197 additions and 1061 deletions
|
@ -36,6 +36,7 @@ typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(16)));
|
|||
* @see strstr()
|
||||
*/
|
||||
noasan char *strcasestr(const char *haystack, const char *needle) {
|
||||
#ifdef __x86_64__
|
||||
char c;
|
||||
xmm_t *p;
|
||||
size_t i;
|
||||
|
@ -68,4 +69,18 @@ noasan char *strcasestr(const char *haystack, const char *needle) {
|
|||
if (!*haystack++) break;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
size_t i;
|
||||
unsigned k, m;
|
||||
if (haystack == needle || !*needle) return haystack;
|
||||
for (;;) {
|
||||
for (i = 0;; ++i) {
|
||||
if (!needle[i]) return (/*unconst*/ char *)haystack;
|
||||
if (!haystack[i]) break;
|
||||
if (kToLower[needle[i] & 255] != kToLower[haystack[i] & 255]) break;
|
||||
}
|
||||
if (!*haystack++) break;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue