mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 12:18: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
19
third_party/gdtoa/gdtoa.internal.h
vendored
19
third_party/gdtoa/gdtoa.internal.h
vendored
|
@ -540,10 +540,8 @@ extern void __gdtoa_memcpy(void *, const void *, size_t);
|
|||
#define gethex __gdtoa_gethex
|
||||
#define hexdig __gdtoa_hexdig
|
||||
#define hexnan __gdtoa_hexnan
|
||||
#define hi0bits(x) __gdtoa_hi0bits((ULong)(x))
|
||||
#define i2b __gdtoa_i2b
|
||||
#define increment __gdtoa_increment
|
||||
#define lo0bits __gdtoa_lo0bits
|
||||
#define lshift __gdtoa_lshift
|
||||
#define match __gdtoa_match
|
||||
#define mult __gdtoa_mult
|
||||
|
@ -594,10 +592,8 @@ extern char *g__fmt(char *, char *, char *, int, ULong, size_t);
|
|||
extern int gethex(CONST char **, CONST FPI *, Long *, Bigint **, int MTd);
|
||||
extern void __gdtoa_hexdig_init(void);
|
||||
extern int hexnan(CONST char **, CONST FPI *, ULong *);
|
||||
extern int __gdtoa_hi0bits(ULong);
|
||||
extern Bigint *i2b(int MTd);
|
||||
extern Bigint *increment(Bigint *MTd);
|
||||
extern int lo0bits(ULong *);
|
||||
extern Bigint *lshift(Bigint *, int MTd);
|
||||
extern int match(CONST char **, char *);
|
||||
extern Bigint *mult(Bigint *, Bigint *MTd);
|
||||
|
@ -617,6 +613,21 @@ extern Bigint *sum(Bigint *, Bigint *MTd);
|
|||
extern int trailz(Bigint *);
|
||||
extern double ulp(U *);
|
||||
|
||||
forceinline int lo0bits(ULong *y) {
|
||||
int k;
|
||||
if (*y) {
|
||||
k = __builtin_ctz(*y);
|
||||
*y >>= k;
|
||||
return k;
|
||||
} else {
|
||||
return 32;
|
||||
}
|
||||
}
|
||||
|
||||
forceinline int hi0bits(ULong x) {
|
||||
return x ? __builtin_clz(x) : 32;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
72
third_party/gdtoa/misc.c
vendored
72
third_party/gdtoa/misc.c
vendored
|
@ -177,49 +177,6 @@ Bfree(Bigint *v MTd)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
lo0bits(ULong *y)
|
||||
{
|
||||
int k;
|
||||
ULong x = *y;
|
||||
|
||||
if (x & 7) {
|
||||
if (x & 1)
|
||||
return 0;
|
||||
if (x & 2) {
|
||||
*y = x >> 1;
|
||||
return 1;
|
||||
}
|
||||
*y = x >> 2;
|
||||
return 2;
|
||||
}
|
||||
k = 0;
|
||||
if (!(x & 0xffff)) {
|
||||
k = 16;
|
||||
x >>= 16;
|
||||
}
|
||||
if (!(x & 0xff)) {
|
||||
k += 8;
|
||||
x >>= 8;
|
||||
}
|
||||
if (!(x & 0xf)) {
|
||||
k += 4;
|
||||
x >>= 4;
|
||||
}
|
||||
if (!(x & 0x3)) {
|
||||
k += 2;
|
||||
x >>= 2;
|
||||
}
|
||||
if (!(x & 1)) {
|
||||
k++;
|
||||
x >>= 1;
|
||||
if (!x)
|
||||
return 32;
|
||||
}
|
||||
*y = x;
|
||||
return k;
|
||||
}
|
||||
|
||||
Bigint *
|
||||
multadd(Bigint *b, int m, int a MTd) /* multiply by m and add a */
|
||||
{
|
||||
|
@ -272,35 +229,6 @@ multadd(Bigint *b, int m, int a MTd) /* multiply by m and add a */
|
|||
return b;
|
||||
}
|
||||
|
||||
int
|
||||
__gdtoa_hi0bits(ULong x)
|
||||
{
|
||||
int k = 0;
|
||||
|
||||
if (!(x & 0xffff0000)) {
|
||||
k = 16;
|
||||
x <<= 16;
|
||||
}
|
||||
if (!(x & 0xff000000)) {
|
||||
k += 8;
|
||||
x <<= 8;
|
||||
}
|
||||
if (!(x & 0xf0000000)) {
|
||||
k += 4;
|
||||
x <<= 4;
|
||||
}
|
||||
if (!(x & 0xc0000000)) {
|
||||
k += 2;
|
||||
x <<= 2;
|
||||
}
|
||||
if (!(x & 0x80000000)) {
|
||||
k++;
|
||||
if (!(x & 0x40000000))
|
||||
return 32;
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
Bigint *
|
||||
i2b(int i MTd)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue