mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-27 15:52:28 +00:00
Make improvements
- Introduce portable sched_getcpu() api - Support GCC's __target_clones__ feature - Make fma() go faster on x86 in default mode - Remove some asan checks from core libraries - WinMain() now ensures $HOME and $USER are defined
This commit is contained in:
parent
d5225a693b
commit
2ab9e9f7fd
192 changed files with 2809 additions and 932 deletions
49
third_party/libcxx/string
vendored
49
third_party/libcxx/string
vendored
|
@ -702,34 +702,41 @@ private:
|
|||
|
||||
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
|
||||
struct __long
|
||||
{
|
||||
pointer __data_;
|
||||
struct __long {
|
||||
pointer __data_;
|
||||
size_type __size_;
|
||||
size_type __cap_;
|
||||
size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
|
||||
size_type __is_long_ : 1;
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_BIG_ENDIAN
|
||||
static const size_type __short_mask = 0x01;
|
||||
static const size_type __long_mask = 0x1ul;
|
||||
#else // _LIBCPP_BIG_ENDIAN
|
||||
static const size_type __short_mask = 0x80;
|
||||
static const size_type __long_mask = ~(size_type(~0) >> 1);
|
||||
#endif // _LIBCPP_BIG_ENDIAN
|
||||
enum { __min_cap = (sizeof(__long) - 1) / sizeof(value_type) > 2 ? (sizeof(__long) - 1) / sizeof(value_type) : 2 };
|
||||
|
||||
enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
|
||||
(sizeof(__long) - 1)/sizeof(value_type) : 2};
|
||||
|
||||
struct __short
|
||||
{
|
||||
struct __short {
|
||||
value_type __data_[__min_cap];
|
||||
struct
|
||||
: __padding<value_type>
|
||||
{
|
||||
unsigned char __size_;
|
||||
};
|
||||
unsigned char __padding_[sizeof(value_type) - 1];
|
||||
unsigned char __size_ : 7;
|
||||
unsigned char __is_long_ : 1;
|
||||
};
|
||||
|
||||
// The __endian_factor is required because the field we use to store the size
|
||||
// has one fewer bit than it would if it were not a bitfield.
|
||||
//
|
||||
// If the LSB is used to store the short-flag in the short string representation,
|
||||
// we have to multiply the size by two when it is stored and divide it by two when
|
||||
// it is loaded to make sure that we always store an even number. In the long string
|
||||
// representation, we can ignore this because we can assume that we always allocate
|
||||
// an even amount of value_types.
|
||||
//
|
||||
// If the MSB is used for the short-flag, the max_size() is numeric_limits<size_type>::max() / 2.
|
||||
// This does not impact the short string representation, since we never need the MSB
|
||||
// for representing the size of a short string anyway.
|
||||
|
||||
# ifdef _LIBCPP_BIG_ENDIAN
|
||||
static const size_type __endian_factor = 2;
|
||||
# else
|
||||
static const size_type __endian_factor = 1;
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
struct __long
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue