Starting on musl port by Arvid Picciani
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141672 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bc90e2a47d
commit
11624459ef
@ -28,3 +28,7 @@ D: FreeBSD port and libcxxrt support.
|
||||
N: Ruben Van Boxem
|
||||
E: vanboxem dot ruben at gmail dot com
|
||||
D: Initial Windows patches.
|
||||
|
||||
N: Arvid Picciani
|
||||
E: aep at exys dot org
|
||||
D: Minor patches and musl port.
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include <locale.h>
|
||||
#if _WIN32
|
||||
# include <support/win32/locale_win32.h>
|
||||
#else // _WIN32
|
||||
#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
|
||||
# include <xlocale.h>
|
||||
#endif // _WIN32
|
||||
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
@ -231,18 +231,18 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
|
||||
|
||||
template <class _CharT>
|
||||
long
|
||||
collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
|
||||
collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
|
||||
{
|
||||
size_t h = 0;
|
||||
const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
|
||||
const size_t mask = size_t(0xF) << (sr + 4);
|
||||
for(const char_type* p = lo; p != hi; ++p)
|
||||
size_t __h = 0;
|
||||
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
|
||||
const size_t __mask = size_t(0xF) << (__sr + 4);
|
||||
for(const char_type* __p = __lo; __p != __hi; ++__p)
|
||||
{
|
||||
h = (h << 4) + *p;
|
||||
size_t g = h & mask;
|
||||
h ^= g | (g >> sr);
|
||||
__h = (__h << 4) + *__p;
|
||||
size_t __g = __h & __mask;
|
||||
__h ^= __g | (__g >> __sr);
|
||||
}
|
||||
return static_cast<long>(h);
|
||||
return static_cast<long>(__h);
|
||||
}
|
||||
|
||||
extern template class _LIBCPP_VISIBLE collate<char>;
|
||||
@ -330,7 +330,7 @@ public:
|
||||
static const mask punct = _PUNCT;
|
||||
static const mask xdigit = _HEX;
|
||||
static const mask blank = _BLANK;
|
||||
#else // __GLIBC__ || _WIN32
|
||||
#elif (__APPLE__ || __FreeBSD__)
|
||||
#if __APPLE__
|
||||
typedef __uint32_t mask;
|
||||
#elif __FreeBSD__
|
||||
@ -346,7 +346,19 @@ public:
|
||||
static const mask punct = _CTYPE_P;
|
||||
static const mask xdigit = _CTYPE_X;
|
||||
static const mask blank = _CTYPE_B;
|
||||
#endif // __GLIBC__ || _WIN32
|
||||
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
|
||||
typedef unsigned long mask;
|
||||
static const mask space = 1<<0;
|
||||
static const mask print = 1<<1;
|
||||
static const mask cntrl = 1<<2;
|
||||
static const mask upper = 1<<3;
|
||||
static const mask lower = 1<<4;
|
||||
static const mask alpha = 1<<5;
|
||||
static const mask digit = 1<<6;
|
||||
static const mask punct = 1<<7;
|
||||
static const mask xdigit = 1<<8;
|
||||
static const mask blank = 1<<9;
|
||||
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
|
||||
static const mask alnum = alpha | digit;
|
||||
static const mask graph = alnum | punct;
|
||||
|
||||
|
@ -3696,7 +3696,7 @@ messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||
#if _WIN32
|
||||
return -1;
|
||||
#else // _WIN32
|
||||
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
|
||||
catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
|
||||
if (__cat != -1)
|
||||
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
|
||||
return __cat;
|
||||
@ -3717,7 +3717,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||
__dflt.c_str() + __dflt.size());
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
nl_catd __cat = (nl_catd)__c;
|
||||
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
|
||||
string_type __w;
|
||||
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
||||
@ -3733,7 +3733,7 @@ messages<_CharT>::do_close(catalog __c) const
|
||||
#if !_WIN32
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
nl_catd __cat = (nl_catd)__c;
|
||||
catclose(__cat);
|
||||
#endif // !_WIN32
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user