diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:44 +0300 |
commit | 59e19371de37995fcb36beb16cd6ec030af960bc (patch) | |
tree | fa68e36093ebff8b805462e9e6d331fe9d348214 /library/cpp/codecs/static/common.h | |
parent | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff) | |
download | ydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs/static/common.h')
-rw-r--r-- | library/cpp/codecs/static/common.h | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/codecs/static/common.h b/library/cpp/codecs/static/common.h index 211de2a27d..84b0349d82 100644 --- a/library/cpp/codecs/static/common.h +++ b/library/cpp/codecs/static/common.h @@ -1,32 +1,32 @@ -#pragma once - -#include <util/string/hex.h> -#include <util/digest/city.h> -#include <util/system/byteorder.h> - -namespace NCodecs { - template <class T> - ui64 DataSignature(const T& t) { - static_assert(!std::is_scalar<T>::value, "no scalars"); +#pragma once + +#include <util/string/hex.h> +#include <util/digest/city.h> +#include <util/system/byteorder.h> + +namespace NCodecs { + template <class T> + ui64 DataSignature(const T& t) { + static_assert(!std::is_scalar<T>::value, "no scalars"); return CityHash64(t.data(), t.size()); - } - - template <class T> + } + + template <class T> TString HexWriteScalar(T t) { - static_assert(std::is_scalar<T>::value, "scalars only"); - t = LittleToBig(t); + static_assert(std::is_scalar<T>::value, "scalars only"); + t = LittleToBig(t); TString res = HexEncode(&t, sizeof(t)); - res.to_lower(); - return res; - } - - template <class T> - T HexReadScalar(TStringBuf s) { - static_assert(std::is_scalar<T>::value, "scalars only"); - T t = 0; + res.to_lower(); + return res; + } + + template <class T> + T HexReadScalar(TStringBuf s) { + static_assert(std::is_scalar<T>::value, "scalars only"); + T t = 0; HexDecode(s.data(), Min(s.size(), sizeof(T)), &t); - t = BigToLittle(t); - return t; - } - -} + t = BigToLittle(t); + return t; + } + +} |