aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/src/charconv.cpp
diff options
context:
space:
mode:
authorAndrey Khalyavin <halyavin@gmail.com>2022-02-10 16:46:29 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:29 +0300
commitf773626848a7c7456803654292e716b83d69cc12 (patch)
treedb052dfcf9134f492bdbb962cb6c16cea58e1ed3 /contrib/libs/cxxsupp/libcxx/src/charconv.cpp
parentf43ab775d197d300eb67bd4497632b909cd7c2a5 (diff)
downloadydb-f773626848a7c7456803654292e716b83d69cc12.tar.gz
Restoring authorship annotation for Andrey Khalyavin <halyavin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/src/charconv.cpp')
-rw-r--r--contrib/libs/cxxsupp/libcxx/src/charconv.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/src/charconv.cpp b/contrib/libs/cxxsupp/libcxx/src/charconv.cpp
index 78439f9683..3477aa6836 100644
--- a/contrib/libs/cxxsupp/libcxx/src/charconv.cpp
+++ b/contrib/libs/cxxsupp/libcxx/src/charconv.cpp
@@ -32,7 +32,7 @@ static constexpr char cDigitsLut[200] = {
template <typename T>
inline _LIBCPP_INLINE_VISIBILITY char*
-append1(char* buffer, T i) noexcept
+append1(char* buffer, T i) noexcept
{
*buffer = '0' + static_cast<char>(i);
return buffer + 1;
@@ -40,7 +40,7 @@ append1(char* buffer, T i) noexcept
template <typename T>
inline _LIBCPP_INLINE_VISIBILITY char*
-append2(char* buffer, T i) noexcept
+append2(char* buffer, T i) noexcept
{
memcpy(buffer, &cDigitsLut[(i)*2], 2);
return buffer + 2;
@@ -48,62 +48,62 @@ append2(char* buffer, T i) noexcept
template <typename T>
inline _LIBCPP_INLINE_VISIBILITY char*
-append3(char* buffer, T i) noexcept
+append3(char* buffer, T i) noexcept
{
return append2(append1(buffer, (i) / 100), (i) % 100);
}
template <typename T>
inline _LIBCPP_INLINE_VISIBILITY char*
-append4(char* buffer, T i) noexcept
+append4(char* buffer, T i) noexcept
{
return append2(append2(buffer, (i) / 100), (i) % 100);
}
-template <typename T>
-inline _LIBCPP_INLINE_VISIBILITY char*
-append2_no_zeros(char* buffer, T v) noexcept
-{
- if (v < 10)
- return append1(buffer, v);
- else
- return append2(buffer, v);
-}
-
-template <typename T>
-inline _LIBCPP_INLINE_VISIBILITY char*
-append4_no_zeros(char* buffer, T v) noexcept
-{
- if (v < 100)
- return append2_no_zeros(buffer, v);
- else if (v < 1000)
- return append3(buffer, v);
- else
- return append4(buffer, v);
-}
-
-template <typename T>
-inline _LIBCPP_INLINE_VISIBILITY char*
-append8_no_zeros(char* buffer, T v) noexcept
-{
- if (v < 10000)
- {
- buffer = append4_no_zeros(buffer, v);
- }
- else
- {
- buffer = append4_no_zeros(buffer, v / 10000);
- buffer = append4(buffer, v % 10000);
- }
- return buffer;
-}
-
-char*
-__u32toa(uint32_t value, char* buffer) noexcept
-{
- if (value < 100000000)
- {
- buffer = append8_no_zeros(buffer, value);
+template <typename T>
+inline _LIBCPP_INLINE_VISIBILITY char*
+append2_no_zeros(char* buffer, T v) noexcept
+{
+ if (v < 10)
+ return append1(buffer, v);
+ else
+ return append2(buffer, v);
+}
+
+template <typename T>
+inline _LIBCPP_INLINE_VISIBILITY char*
+append4_no_zeros(char* buffer, T v) noexcept
+{
+ if (v < 100)
+ return append2_no_zeros(buffer, v);
+ else if (v < 1000)
+ return append3(buffer, v);
+ else
+ return append4(buffer, v);
+}
+
+template <typename T>
+inline _LIBCPP_INLINE_VISIBILITY char*
+append8_no_zeros(char* buffer, T v) noexcept
+{
+ if (v < 10000)
+ {
+ buffer = append4_no_zeros(buffer, v);
+ }
+ else
+ {
+ buffer = append4_no_zeros(buffer, v / 10000);
+ buffer = append4(buffer, v % 10000);
+ }
+ return buffer;
+}
+
+char*
+__u32toa(uint32_t value, char* buffer) noexcept
+{
+ if (value < 100000000)
+ {
+ buffer = append8_no_zeros(buffer, value);
}
else
{
@@ -111,7 +111,7 @@ __u32toa(uint32_t value, char* buffer) noexcept
const uint32_t a = value / 100000000; // 1 to 42
value %= 100000000;
- buffer = append2_no_zeros(buffer, a);
+ buffer = append2_no_zeros(buffer, a);
buffer = append4(buffer, value / 10000);
buffer = append4(buffer, value % 10000);
}
@@ -120,19 +120,19 @@ __u32toa(uint32_t value, char* buffer) noexcept
}
char*
-__u64toa(uint64_t value, char* buffer) noexcept
+__u64toa(uint64_t value, char* buffer) noexcept
{
if (value < 100000000)
{
uint32_t v = static_cast<uint32_t>(value);
- buffer = append8_no_zeros(buffer, v);
+ buffer = append8_no_zeros(buffer, v);
}
else if (value < 10000000000000000)
{
const uint32_t v0 = static_cast<uint32_t>(value / 100000000);
const uint32_t v1 = static_cast<uint32_t>(value % 100000000);
- buffer = append8_no_zeros(buffer, v0);
+ buffer = append8_no_zeros(buffer, v0);
buffer = append4(buffer, v1 / 10000);
buffer = append4(buffer, v1 % 10000);
}
@@ -142,7 +142,7 @@ __u64toa(uint64_t value, char* buffer) noexcept
static_cast<uint32_t>(value / 10000000000000000); // 1 to 1844
value %= 10000000000000000;
- buffer = append4_no_zeros(buffer, a);
+ buffer = append4_no_zeros(buffer, a);
const uint32_t v0 = static_cast<uint32_t>(value / 100000000);
const uint32_t v1 = static_cast<uint32_t>(value % 100000000);