Add APE interpreter example (#263)

This commit is contained in:
Justine Tunney 2021-09-04 00:58:21 -07:00
parent 5b60e5a37d
commit 969174e155
7 changed files with 210 additions and 14 deletions

View file

@ -23,9 +23,15 @@
* @asyncsignalsafe
*/
wchar_t *wmemset(wchar_t *p, wchar_t c, size_t n) {
size_t i;
for (i = 0; i < n; ++i) {
p[i] = c;
size_t i = 0;
if (n >= 4) {
wchar_t v __attribute__((__vector_size__(16))) = {c, c, c, c};
do {
__builtin_memcpy(p + i, &v, 16);
} while ((i += 4) + 4 <= n);
}
while (i < n) {
p[i++] = c;
}
return p;
}