Import C++ Standard Template Library

You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.

- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()

Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
This commit is contained in:
Justine Tunney 2022-03-22 05:51:41 -07:00
parent 5022f9e920
commit 868af3f950
286 changed files with 123987 additions and 507 deletions

View file

@ -20,7 +20,7 @@ COSMOPOLITAN_C_START_
int bsf(int) pureconst;
int bsfl(long) pureconst;
int bsfll(long long) pureconst;
int bsfmax(uintmax_t) pureconst;
int bsf128(uintmax_t) pureconst;
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define bsf(u) \

View file

@ -20,7 +20,7 @@ COSMOPOLITAN_C_START_
int bsr(int) pureconst;
int bsrl(long) pureconst;
int bsrll(long long) pureconst;
int bsrmax(uintmax_t) pureconst;
int bsr128(uint128_t) pureconst;
#if defined(__GNUC__) && defined(__x86_64__) && !defined(__STRICT_ANSI__)
#define bsr(u) \

View file

@ -33,7 +33,7 @@
// @param rsi:rdi is 128-bit unsigned 𝑥 value
// @return eax number in range [0,128) or undef if 𝑥 is 0
// @see also treasure trove of nearly identical functions
bsrmax: .leafprologue
bsr128: .leafprologue
.profilable
bsr %rsi,%rax
jnz 2f
@ -41,4 +41,4 @@ bsrmax: .leafprologue
1: .leafepilogue
2: add $64,%eax
jmp 1b
.endfn bsrmax,globl
.endfn bsr128,globl