mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 00:32:29 +00:00
Make numerous improvements
- Python static hello world now 1.8mb - Python static fully loaded now 10mb - Python HTTPS client now uses MbedTLS - Python REPL now completes import stmts - Increase stack size for Python for now - Begin synthesizing posixpath and ntpath - Restore Python \N{UNICODE NAME} support - Restore Python NFKD symbol normalization - Add optimized code path for Intel SHA-NI - Get more Python unit tests passing faster - Get Python help() pagination working on NT - Python hashlib now supports MbedTLS PBKDF2 - Make memcpy/memmove/memcmp/bcmp/etc. faster - Add Mersenne Twister and Vigna to LIBC_RAND - Provide privileged __printf() for error code - Fix zipos opendir() so that it reports ENOTDIR - Add basic chmod() implementation for Windows NT - Add Cosmo's best functions to Python cosmo module - Pin function trace indent depth to that of caller - Show memory diagram on invalid access in MODE=dbg - Differentiate stack overflow on crash in MODE=dbg - Add stb_truetype and tools for analyzing font files - Upgrade to UNICODE 13 and reduce its binary footprint - COMPILE.COM now logs resource usage of build commands - Start implementing basic poll() support on bare metal - Set getauxval(AT_EXECFN) to GetModuleFileName() on NT - Add descriptions to strerror() in non-TINY build modes - Add COUNTBRANCH() macro to help with micro-optimizations - Make error / backtrace / asan / memory code more unbreakable - Add fast perfect C implementation of μ-Law and a-Law audio codecs - Make strtol() functions consistent with other libc implementations - Improve Linenoise implementation (see also github.com/jart/bestline) - COMPILE.COM now suppresses stdout/stderr of successful build commands
This commit is contained in:
parent
fa7b4f5bd1
commit
39bf41f4eb
806 changed files with 77494 additions and 63859 deletions
|
@ -39,10 +39,8 @@ libmpdec (BSD-2)\\n\
|
|||
Copyright 2008-2016 Stefan Krah\"");
|
||||
asm(".include \"libc/disclaimer.inc\"");
|
||||
|
||||
|
||||
/* Bignum: The actual transform routine (decimation in frequency). */
|
||||
|
||||
|
||||
/*
|
||||
* Generate index pairs (x, bitreverse(x)) and carry out the permutation.
|
||||
* n must be a power of two.
|
||||
|
@ -55,7 +53,6 @@ bitreverse_permute(mpd_uint_t a[], mpd_size_t n)
|
|||
mpd_size_t x = 0;
|
||||
mpd_size_t r = 0;
|
||||
mpd_uint_t t;
|
||||
|
||||
do { /* Invariant: r = bitreverse(x) */
|
||||
if (r > x) {
|
||||
t = a[x];
|
||||
|
@ -72,105 +69,68 @@ bitreverse_permute(mpd_uint_t a[], mpd_size_t n)
|
|||
} while (x < n);
|
||||
}
|
||||
|
||||
|
||||
/* Fast Number Theoretic Transform, decimation in frequency. */
|
||||
void
|
||||
fnt_dif2(mpd_uint_t a[], mpd_size_t n, struct fnt_params *tparams)
|
||||
{
|
||||
mpd_uint_t *wtable = tparams->wtable;
|
||||
mpd_uint_t umod;
|
||||
#ifdef PPRO
|
||||
double dmod;
|
||||
uint32_t dinvmod[3];
|
||||
#endif
|
||||
mpd_uint_t u0, u1, v0, v1;
|
||||
mpd_uint_t w, w0, w1, wstep;
|
||||
mpd_size_t m, mhalf;
|
||||
mpd_size_t j, r;
|
||||
|
||||
|
||||
assert(ispower2(n));
|
||||
assert(n >= 4);
|
||||
|
||||
SETMODULUS(tparams->modnum);
|
||||
|
||||
/* m == n */
|
||||
mhalf = n / 2;
|
||||
for (j = 0; j < mhalf; j += 2) {
|
||||
|
||||
w0 = wtable[j];
|
||||
w1 = wtable[j+1];
|
||||
|
||||
u0 = a[j];
|
||||
v0 = a[j+mhalf];
|
||||
|
||||
u1 = a[j+1];
|
||||
v1 = a[j+1+mhalf];
|
||||
|
||||
a[j] = addmod(u0, v0, umod);
|
||||
v0 = submod(u0, v0, umod);
|
||||
|
||||
a[j+1] = addmod(u1, v1, umod);
|
||||
v1 = submod(u1, v1, umod);
|
||||
|
||||
MULMOD2(&v0, w0, &v1, w1);
|
||||
|
||||
a[j+mhalf] = v0;
|
||||
a[j+1+mhalf] = v1;
|
||||
|
||||
}
|
||||
|
||||
wstep = 2;
|
||||
for (m = n/2; m >= 2; m>>=1, wstep<<=1) {
|
||||
|
||||
mhalf = m / 2;
|
||||
|
||||
/* j == 0 */
|
||||
for (r = 0; r < n; r += 2*m) {
|
||||
|
||||
u0 = a[r];
|
||||
v0 = a[r+mhalf];
|
||||
|
||||
u1 = a[m+r];
|
||||
v1 = a[m+r+mhalf];
|
||||
|
||||
a[r] = addmod(u0, v0, umod);
|
||||
v0 = submod(u0, v0, umod);
|
||||
|
||||
a[m+r] = addmod(u1, v1, umod);
|
||||
v1 = submod(u1, v1, umod);
|
||||
|
||||
a[r+mhalf] = v0;
|
||||
a[m+r+mhalf] = v1;
|
||||
}
|
||||
|
||||
for (j = 1; j < mhalf; j++) {
|
||||
|
||||
w = wtable[j*wstep];
|
||||
|
||||
for (r = 0; r < n; r += 2*m) {
|
||||
|
||||
u0 = a[r+j];
|
||||
v0 = a[r+j+mhalf];
|
||||
|
||||
u1 = a[m+r+j];
|
||||
v1 = a[m+r+j+mhalf];
|
||||
|
||||
a[r+j] = addmod(u0, v0, umod);
|
||||
v0 = submod(u0, v0, umod);
|
||||
|
||||
a[m+r+j] = addmod(u1, v1, umod);
|
||||
v1 = submod(u1, v1, umod);
|
||||
|
||||
MULMOD2C(&v0, &v1, w);
|
||||
|
||||
a[r+j+mhalf] = v0;
|
||||
a[m+r+j+mhalf] = v1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bitreverse_permute(a, n);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue