[libcxx-commits] [PATCH] D107709: [libc++][NFC] Remove MSVC specific code.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 9 09:14:06 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG96ed451f8d5d: [libc++][NFC] Remove MSVC specific code. (authored by Mordante).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107709/new/
https://reviews.llvm.org/D107709
Files:
libcxx/include/charconv
Index: libcxx/include/charconv
===================================================================
--- libcxx/include/charconv
+++ libcxx/include/charconv
@@ -74,6 +74,7 @@
*/
#include <__availability>
+#include <__bits>
#include <__config>
#include <__errc>
#include <__utility/to_underlying.h>
@@ -204,13 +205,11 @@
{
using type = uint64_t;
-#if !defined(_LIBCPP_COMPILER_MSVC)
static _LIBCPP_INLINE_VISIBILITY int __width(_Tp __v)
{
- auto __t = (64 - __builtin_clzll(__v | 1)) * 1233 >> 12;
+ auto __t = (64 - _VSTD::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12;
return __t - (__v < __pow10_64[__t]) + 1;
}
-#endif
_LIBCPP_AVAILABILITY_TO_CHARS
static _LIBCPP_INLINE_VISIBILITY char* __convert(_Tp __v, char* __p)
@@ -227,13 +226,11 @@
{
using type = uint32_t;
-#if !defined(_LIBCPP_COMPILER_MSVC)
static _LIBCPP_INLINE_VISIBILITY int __width(_Tp __v)
{
- auto __t = (32 - __builtin_clz(__v | 1)) * 1233 >> 12;
+ auto __t = (32 - _VSTD::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12;
return __t - (__v < __pow10_32[__t]) + 1;
}
-#endif
_LIBCPP_AVAILABILITY_TO_CHARS
static _LIBCPP_INLINE_VISIBILITY char* __convert(_Tp __v, char* __p)
@@ -354,28 +351,10 @@
using __tx = __itoa::__traits<_Tp>;
auto __diff = __last - __first;
-#if !defined(_LIBCPP_COMPILER_MSVC)
if (__tx::digits <= __diff || __tx::__width(__value) <= __diff)
return {__tx::__convert(__value, __first), errc(0)};
else
return {__last, errc::value_too_large};
-#else
- if (__tx::digits <= __diff)
- return {__tx::__convert(__value, __first), {}};
- else
- {
- char __buf[__tx::digits];
- auto __p = __tx::__convert(__value, __buf);
- auto __len = __p - __buf;
- if (__len <= __diff)
- {
- _VSTD::memcpy(__first, __buf, __len);
- return {__first + __len, {}};
- }
- else
- return {__last, errc::value_too_large};
- }
-#endif
}
template <typename _Tp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107709.365201.patch
Type: text/x-patch
Size: 2105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210809/b8733470/attachment.bin>
More information about the libcxx-commits
mailing list