mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 22:32:28 +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
|
@ -5,7 +5,6 @@
|
|||
/* clang-format off */
|
||||
|
||||
/* Internal header file: all symbols have local scope in the DSO */
|
||||
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
|
||||
|
||||
mpd_uint_t _mpd_baseadd(mpd_uint_t *w, const mpd_uint_t *u, const mpd_uint_t *v,
|
||||
mpd_size_t m, mpd_size_t n);
|
||||
|
@ -36,7 +35,6 @@ void _mpd_baseshiftl(mpd_uint_t *dest, mpd_uint_t *src, mpd_size_t n,
|
|||
mpd_uint_t _mpd_baseshiftr(mpd_uint_t *dest, mpd_uint_t *src, mpd_size_t slen,
|
||||
mpd_size_t shift);
|
||||
|
||||
#ifdef CONFIG_64
|
||||
extern const mpd_uint_t mprime_rdx;
|
||||
|
||||
/*
|
||||
|
@ -66,12 +64,10 @@ _mpd_div_words_r(mpd_uint_t *q, mpd_uint_t *r, mpd_uint_t hi, mpd_uint_t lo)
|
|||
{
|
||||
mpd_uint_t n_adj, h, l, t;
|
||||
mpd_uint_t n1_neg;
|
||||
|
||||
/* n1_neg = if lo >= 2**63 then MPD_UINT_MAX else 0 */
|
||||
n1_neg = (lo & (1ULL<<63)) ? MPD_UINT_MAX : 0;
|
||||
/* n_adj = if lo >= 2**63 then lo+MPD_RADIX else lo */
|
||||
n_adj = lo + (n1_neg & MPD_RADIX);
|
||||
|
||||
/* (h, l) = if lo >= 2**63 then m'*(hi+1) else m'*hi */
|
||||
_mpd_mul_words(&h, &l, mprime_rdx, hi-n1_neg);
|
||||
l = l + n_adj;
|
||||
|
@ -80,10 +76,8 @@ _mpd_div_words_r(mpd_uint_t *q, mpd_uint_t *r, mpd_uint_t hi, mpd_uint_t lo)
|
|||
/* At this point t == qest, with q == qest or q == qest+1:
|
||||
* 1) 0 <= 2**64*hi + lo - qest*MPD_RADIX < 2*MPD_RADIX
|
||||
*/
|
||||
|
||||
/* t = 2**64-1 - qest = 2**64 - (qest+1) */
|
||||
t = MPD_UINT_MAX - t;
|
||||
|
||||
/* (h, l) = 2**64*MPD_RADIX - (qest+1)*MPD_RADIX */
|
||||
_mpd_mul_words(&h, &l, t, MPD_RADIX);
|
||||
l = l + lo;
|
||||
|
@ -100,25 +94,15 @@ _mpd_div_words_r(mpd_uint_t *q, mpd_uint_t *r, mpd_uint_t hi, mpd_uint_t lo)
|
|||
* b) q := h - t == qest
|
||||
* c) r := l + MPD_RADIX = r
|
||||
*/
|
||||
|
||||
*q = (h - t);
|
||||
*r = l + (MPD_RADIX & h);
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
_mpd_div_words_r(mpd_uint_t *q, mpd_uint_t *r, mpd_uint_t hi, mpd_uint_t lo)
|
||||
{
|
||||
_mpd_div_words(q, r, hi, lo, MPD_RADIX);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Multiply two single base MPD_RADIX words, store result in array w[2]. */
|
||||
static inline void
|
||||
_mpd_singlemul(mpd_uint_t w[2], mpd_uint_t u, mpd_uint_t v)
|
||||
{
|
||||
mpd_uint_t hi, lo;
|
||||
|
||||
_mpd_mul_words(&hi, &lo, u, v);
|
||||
_mpd_div_words_r(&w[1], &w[0], hi, lo);
|
||||
}
|
||||
|
@ -128,21 +112,17 @@ static inline void
|
|||
_mpd_mul_2_le2(mpd_uint_t w[4], mpd_uint_t u[2], mpd_uint_t v[2], mpd_ssize_t m)
|
||||
{
|
||||
mpd_uint_t hi, lo;
|
||||
|
||||
_mpd_mul_words(&hi, &lo, u[0], v[0]);
|
||||
_mpd_div_words_r(&w[1], &w[0], hi, lo);
|
||||
|
||||
_mpd_mul_words(&hi, &lo, u[1], v[0]);
|
||||
lo = w[1] + lo;
|
||||
if (lo < w[1]) hi++;
|
||||
_mpd_div_words_r(&w[2], &w[1], hi, lo);
|
||||
if (m == 1) return;
|
||||
|
||||
_mpd_mul_words(&hi, &lo, u[0], v[1]);
|
||||
lo = w[1] + lo;
|
||||
if (lo < w[1]) hi++;
|
||||
_mpd_div_words_r(&w[3], &w[1], hi, lo);
|
||||
|
||||
_mpd_mul_words(&hi, &lo, u[1], v[1]);
|
||||
lo = w[2] + lo;
|
||||
if (lo < w[2]) hi++;
|
||||
|
@ -151,7 +131,6 @@ _mpd_mul_2_le2(mpd_uint_t w[4], mpd_uint_t u[2], mpd_uint_t v[2], mpd_ssize_t m)
|
|||
_mpd_div_words_r(&w[3], &w[2], hi, lo);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Test if all words from data[len-1] to data[0] are zero. If len is 0, nothing
|
||||
* is tested and the coefficient is regarded as "all zero".
|
||||
|
@ -178,6 +157,5 @@ _mpd_isallnine(const mpd_uint_t *data, mpd_ssize_t len)
|
|||
return 1;
|
||||
}
|
||||
|
||||
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
|
||||
|
||||
#endif /* BASEARITH_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue