summaryrefslogtreecommitdiffstats
path: root/library/cpp/packers
diff options
context:
space:
mode:
authorleo <[email protected]>2022-02-10 16:46:40 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:46:40 +0300
commit980edcd3304699edf9d4e4d6a656e585028e2a72 (patch)
tree139f47f3911484ae9af0eb347b1a88bd6c4bb35f /library/cpp/packers
parentb036a557f285146e5e35d4213e29a094ab907bcf (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/packers')
-rw-r--r--library/cpp/packers/packers.h76
1 files changed, 38 insertions, 38 deletions
diff --git a/library/cpp/packers/packers.h b/library/cpp/packers/packers.h
index 1bde1b59aaf..20248defae2 100644
--- a/library/cpp/packers/packers.h
+++ b/library/cpp/packers/packers.h
@@ -64,27 +64,27 @@ namespace NPackers {
}
}
- namespace NImpl {
- template <class T, bool isSigned>
- struct TConvertImpl {
- static inline ui64 Convert(const T& data);
- };
-
- template <class T>
- struct TConvertImpl<T, true> {
- static inline ui64 Convert(const T& data) {
- return ConvertIntegral<i64>(static_cast<i64>(data));
- }
- };
-
- template <class T>
- struct TConvertImpl<T, false> {
- static inline ui64 Convert(const T& data) {
- return data;
- }
- };
- }
-
+ namespace NImpl {
+ template <class T, bool isSigned>
+ struct TConvertImpl {
+ static inline ui64 Convert(const T& data);
+ };
+
+ template <class T>
+ struct TConvertImpl<T, true> {
+ static inline ui64 Convert(const T& data) {
+ return ConvertIntegral<i64>(static_cast<i64>(data));
+ }
+ };
+
+ template <class T>
+ struct TConvertImpl<T, false> {
+ static inline ui64 Convert(const T& data) {
+ return data;
+ }
+ };
+ }
+
template <class T>
inline ui64 ConvertIntegral(const T& data) {
static_assert(std::is_integral<T>::value, "T must be integral type");
@@ -149,33 +149,33 @@ namespace NPackers {
return SkipTable[(ui8)*p];
}
- namespace NImpl {
- template <class T, bool isSigned>
- struct TUnpackLeafImpl {
+ namespace NImpl {
+ template <class T, bool isSigned>
+ struct TUnpackLeafImpl {
inline void UnpackLeaf(const char* p, T& t) const;
- };
- template <class T>
- struct TUnpackLeafImpl<T, true> {
+ };
+ template <class T>
+ struct TUnpackLeafImpl<T, true> {
inline void UnpackLeaf(const char* p, T& t) const {
ui64 val;
TIntegralPacker<ui64>().UnpackLeaf(p, val);
- if (val & 1) {
+ if (val & 1) {
t = -1 * static_cast<i64>(val >> 1);
- } else {
+ } else {
t = static_cast<T>(val >> 1);
- }
- }
- };
- template <class T>
- struct TUnpackLeafImpl<T, false> {
+ }
+ }
+ };
+ template <class T>
+ struct TUnpackLeafImpl<T, false> {
inline void UnpackLeaf(const char* p, T& t) const {
ui64 tmp;
TIntegralPacker<ui64>().UnpackLeaf(p, tmp);
t = static_cast<T>(tmp);
- }
- };
- }
-
+ }
+ };
+ }
+
template <class T>
inline void TIntegralPacker<T>::UnpackLeaf(const char* p, T& t) const {
NImpl::TUnpackLeafImpl<T, std::is_signed<T>::value>().UnpackLeaf(p, t);