Make fixes, improvements, and chibicc python bindings

- python now mixes audio 10x faster
- python octal notation is restored
- chibicc now builds code 3x faster
- chibicc now has help documentation
- chibicc can now generate basic python bindings
- linenoise now supports some paredit-like features

See #141
This commit is contained in:
Justine Tunney 2021-10-08 08:11:51 -07:00
parent 28997f3acb
commit 7061c79c22
121 changed files with 5272 additions and 1928 deletions

View file

@ -849,7 +849,34 @@ audioop_add_impl(PyObject *module, Py_buffer *fragment1,
if (rv == NULL)
return NULL;
ncp = (signed char *)PyBytes_AsString(rv);
for (i = 0; i < fragment1->len; i += width) {
i = 0;
#if defined(__GNUC__) && defined(__SSE2__)
/* [jart] make audio mixing 20x faster */
if (width == 2) {
for (; i + 16 <= fragment1->len; i += 16) {
asm("movups\t%1,%%xmm0\n\t"
"movups\t%2,%%xmm1\n\t"
"paddsw\t%%xmm1,%%xmm0\n\t"
"movups\t%%xmm0,%0"
: "=m"(*(char(*)[16])(ncp + i))
: "m"(*(char(*)[16])((char *)fragment1->buf + i)),
"m"(*(char(*)[16])((char *)fragment2->buf + i))
: "xmm0", "xmm1");
}
} else if (width == 1) {
for (; i + 16 <= fragment1->len; i += 16) {
asm("movups\t%1,%%xmm0\n\t"
"movups\t%2,%%xmm1\n\t"
"paddsb\t%%xmm1,%%xmm0\n\t"
"movups\t%%xmm0,%0"
: "=m"(*(char(*)[16])(ncp + i))
: "m"(*(char(*)[16])((char *)fragment1->buf + i)),
"m"(*(char(*)[16])((char *)fragment2->buf + i))
: "xmm0", "xmm1");
}
}
#endif
for (; i < fragment1->len; i += width) {
int val1 = GETRAWSAMPLE(width, fragment1->buf, i);
int val2 = GETRAWSAMPLE(width, fragment2->buf, i);
if (width < 4) {