Refactor _LIBCPP_<LITTLE|BIG>_ENDIAN
Previously this macro used 0/1 to indicate if it was set.
This is unlike all other libc++ configuration macros which
use ifdef/ifndef.
This patch makes this macro consistent with everything else.
llvm-svn: 315995
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: da0183947f9f4ca5a642a4abf2bfeb2a99e7430f
diff --git a/include/string b/include/string
index 7775587..acd2876 100644
--- a/include/string
+++ b/include/string
@@ -670,7 +670,7 @@
size_type __cap_;
};
-#if _LIBCPP_BIG_ENDIAN
+#ifdef _LIBCPP_BIG_ENDIAN
static const size_type __short_mask = 0x01;
static const size_type __long_mask = 0x1ul;
#else // _LIBCPP_BIG_ENDIAN
@@ -700,7 +700,7 @@
pointer __data_;
};
-#if _LIBCPP_BIG_ENDIAN
+#ifdef _LIBCPP_BIG_ENDIAN
static const size_type __short_mask = 0x80;
static const size_type __long_mask = ~(size_type(~0) >> 1);
#else // _LIBCPP_BIG_ENDIAN
@@ -1241,7 +1241,7 @@
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
-# if _LIBCPP_BIG_ENDIAN
+# ifdef _LIBCPP_BIG_ENDIAN
{__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
# else
{__r_.first().__s.__size_ = (unsigned char)(__s);}
@@ -1249,7 +1249,7 @@
_LIBCPP_INLINE_VISIBILITY
size_type __get_short_size() const _NOEXCEPT
-# if _LIBCPP_BIG_ENDIAN
+# ifdef _LIBCPP_BIG_ENDIAN
{return __r_.first().__s.__size_ >> 1;}
# else
{return __r_.first().__s.__size_;}
@@ -1259,7 +1259,7 @@
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
-# if _LIBCPP_BIG_ENDIAN
+# ifdef _LIBCPP_BIG_ENDIAN
{__r_.first().__s.__size_ = (unsigned char)(__s);}
# else
{__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
@@ -1267,7 +1267,7 @@
_LIBCPP_INLINE_VISIBILITY
size_type __get_short_size() const _NOEXCEPT
-# if _LIBCPP_BIG_ENDIAN
+# ifdef _LIBCPP_BIG_ENDIAN
{return __r_.first().__s.__size_;}
# else
{return __r_.first().__s.__size_ >> 1;}
@@ -2870,7 +2870,7 @@
basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT
{
size_type __m = __alloc_traits::max_size(__alloc());
-#if _LIBCPP_BIG_ENDIAN
+#ifdef _LIBCPP_BIG_ENDIAN
return (__m <= ~__long_mask ? __m : __m/2) - __alignment;
#else
return __m - __alignment;