mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Perform build and magnum tuning
Building o//third_party/python now takes 5 seconds on my PC This change works towards modifying Python to use runtime dispatching when appropriate. For example, when loading the magnums in the socket module, it's a good idea to check if the magnum is zero, because that means the local system platform doesn't support it.
This commit is contained in:
parent
ee7e296339
commit
d26d7ae0e4
1028 changed files with 6576 additions and 172777 deletions
18
third_party/python/Objects/longobject.c
vendored
18
third_party/python/Objects/longobject.c
vendored
|
@ -1,13 +1,11 @@
|
|||
/* clang-format off */
|
||||
/* Long (arbitrary precision) integer object implementation */
|
||||
|
||||
/* XXX The functional organization of this file is terrible */
|
||||
|
||||
#include "Python.h"
|
||||
#include "longintrepr.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <ctype.h>
|
||||
#include <stddef.h>
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "third_party/python/Include/longintrepr.h"
|
||||
|
||||
#ifndef NSMALLPOSINTS
|
||||
#define NSMALLPOSINTS 257
|
||||
|
@ -1583,7 +1581,7 @@ long_to_decimal_string_internal(PyObject *aa,
|
|||
digit *pout, *pin, rem, tenpow;
|
||||
int negative;
|
||||
int d;
|
||||
enum PyUnicode_Kind kind;
|
||||
enum PyUnicode_Kind kind = -1;
|
||||
|
||||
a = (PyLongObject *)aa;
|
||||
if (a == NULL || !PyLong_Check(a)) {
|
||||
|
@ -1675,6 +1673,8 @@ long_to_decimal_string_internal(PyObject *aa,
|
|||
kind = PyUnicode_KIND(str);
|
||||
}
|
||||
|
||||
CHECK_NE(-1, kind); /* if this fails there's a serious bug upstream */
|
||||
|
||||
#define WRITE_DIGITS(p) \
|
||||
do { \
|
||||
/* pout[0] through pout[size-2] contribute exactly \
|
||||
|
@ -1773,7 +1773,7 @@ long_format_binary(PyObject *aa, int base, int alternate,
|
|||
PyObject *v = NULL;
|
||||
Py_ssize_t sz;
|
||||
Py_ssize_t size_a;
|
||||
enum PyUnicode_Kind kind;
|
||||
enum PyUnicode_Kind kind = -1;
|
||||
int negative;
|
||||
int bits;
|
||||
|
||||
|
@ -1840,6 +1840,8 @@ long_format_binary(PyObject *aa, int base, int alternate,
|
|||
kind = PyUnicode_KIND(v);
|
||||
}
|
||||
|
||||
CHECK_NE(-1, kind); /* if this fails there's a serious bug upstream */
|
||||
|
||||
#define WRITE_DIGITS(p) \
|
||||
do { \
|
||||
if (size_a == 0) { \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue