mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
Make improvements
- wcsstr() is now linearly complex - strstr16() is now linearly complex - strstr() is now vectorized on aarch64 (10x) - strstr() now uses KMP on pathological cases - memmem() is now vectorized on aarch64 (10x) - memmem() now uses KMP on pathological cases - Disable shared_ptr::owner_before until fixed - Make iswlower(), iswupper() consistent with glibc - Remove figure space from iswspace() implementation - Include line and paragraph separator in iswcntrl() - Use Musl wcwidth(), iswalpha(), iswpunct(), towlower(), towupper()
This commit is contained in:
parent
e1528a71e2
commit
7c83f4abc8
67 changed files with 5602 additions and 5165 deletions
|
@ -33,24 +33,22 @@ privileged int __get_symbol(struct SymbolTable *t, intptr_t a) {
|
|||
// we don't want function tracing because:
|
||||
// function tracing depends on this function via kprintf
|
||||
unsigned l, m, r, n, k;
|
||||
if (!t && __symtab) {
|
||||
if (!t && __symtab)
|
||||
t = __symtab;
|
||||
}
|
||||
if (t) {
|
||||
l = 0;
|
||||
r = n = t->count;
|
||||
k = a - t->addr_base;
|
||||
while (l < r) {
|
||||
m = (l & r) + ((l ^ r) >> 1); // floor((a+b)/2)
|
||||
if (t->symbols[m].y < k) {
|
||||
if (k < t->symbols[m].x) {
|
||||
r = m;
|
||||
} else if (k > t->symbols[m].y) {
|
||||
l = m + 1;
|
||||
} else {
|
||||
r = m;
|
||||
return m;
|
||||
}
|
||||
}
|
||||
if (l < n && t->symbols[l].x <= k && k <= t->symbols[l].y) {
|
||||
return l;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue