mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
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:
parent
28997f3acb
commit
7061c79c22
121 changed files with 5272 additions and 1928 deletions
|
@ -28,7 +28,6 @@
|
|||
│ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/complexobject.h"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#ifndef UMODARITH_H
|
||||
#define UMODARITH_H
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "third_party/python/Modules/_decimal/libmpdec/constants.h"
|
||||
#include "third_party/python/Modules/_decimal/libmpdec/mpdecimal.h"
|
||||
#include "third_party/python/Modules/_decimal/libmpdec/typearith.h"
|
||||
|
|
2
third_party/python/Modules/_hashmbedtls.c
vendored
2
third_party/python/Modules/_hashmbedtls.c
vendored
|
@ -18,7 +18,6 @@
|
|||
#define PY_SSIZE_T_CLEAN
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/log/backtrace.internal.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
@ -27,7 +26,6 @@
|
|||
#include "third_party/mbedtls/md.h"
|
||||
#include "third_party/mbedtls/pkcs5.h"
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/ezprint.h"
|
||||
#include "third_party/python/Include/import.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
|
|
4
third_party/python/Modules/_testcapimodule.c
vendored
4
third_party/python/Modules/_testcapimodule.c
vendored
|
@ -1629,7 +1629,7 @@ getargs_u(PyObject *self, PyObject *args)
|
|||
Py_ssize_t size;
|
||||
if (!PyArg_ParseTuple(args, "u", &str))
|
||||
return NULL;
|
||||
size = Py_UNICODE_strlen(str);
|
||||
size = wcslen(str);
|
||||
return PyUnicode_FromUnicode(str, size);
|
||||
}
|
||||
|
||||
|
@ -1651,7 +1651,7 @@ getargs_Z(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "Z", &str))
|
||||
return NULL;
|
||||
if (str != NULL) {
|
||||
size = Py_UNICODE_strlen(str);
|
||||
size = wcslen(str);
|
||||
return PyUnicode_FromUnicode(str, size);
|
||||
} else
|
||||
Py_RETURN_NONE;
|
||||
|
|
29
third_party/python/Modules/audioop.c
vendored
29
third_party/python/Modules/audioop.c
vendored
|
@ -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) {
|
||||
|
|
1
third_party/python/Modules/tlsmodule.c
vendored
1
third_party/python/Modules/tlsmodule.c
vendored
|
@ -19,7 +19,6 @@
|
|||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue