aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp
diff options
context:
space:
mode:
authordvorkanton <dvorkanton@yandex-team.ru>2022-02-10 16:46:04 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:04 +0300
commit110a978b66fe6c0916572df51cfead2a9b647174 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp
parentce1ca0f8ad5b8231d32b35629f85bb09beea1bfb (diff)
downloadydb-110a978b66fe6c0916572df51cfead2a9b647174.tar.gz
Restoring authorship annotation for <dvorkanton@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp')
-rw-r--r--library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp
index 1fe7bb3a7d..da2831fbd2 100644
--- a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp
+++ b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp
@@ -1,54 +1,54 @@
#include <library/cpp/blockcodecs/core/codecs.h>
#include <library/cpp/blockcodecs/core/common.h>
#include <library/cpp/blockcodecs/core/register.h>
-
-#include <contrib/libs/fastlz/fastlz.h>
-
-using namespace NBlockCodecs;
-
-namespace {
- struct TFastLZCodec: public TAddLengthCodec<TFastLZCodec> {
- inline TFastLZCodec(int level)
- : MyName("fastlz-" + ToString(level))
- , Level(level)
- {
- }
-
- static inline size_t DoMaxCompressedLength(size_t in) noexcept {
- return Max<size_t>(in + in / 20, 128);
- }
-
- TStringBuf Name() const noexcept override {
- return MyName;
- }
-
- inline size_t DoCompress(const TData& in, void* buf) const {
- if (Level) {
- return fastlz_compress_level(Level, in.data(), in.size(), buf);
- }
-
- return fastlz_compress(in.data(), in.size(), buf);
- }
-
- inline void DoDecompress(const TData& in, void* out, size_t len) const {
- const int ret = fastlz_decompress(in.data(), in.size(), out, len);
-
- if (ret < 0 || (size_t)ret != len) {
+
+#include <contrib/libs/fastlz/fastlz.h>
+
+using namespace NBlockCodecs;
+
+namespace {
+ struct TFastLZCodec: public TAddLengthCodec<TFastLZCodec> {
+ inline TFastLZCodec(int level)
+ : MyName("fastlz-" + ToString(level))
+ , Level(level)
+ {
+ }
+
+ static inline size_t DoMaxCompressedLength(size_t in) noexcept {
+ return Max<size_t>(in + in / 20, 128);
+ }
+
+ TStringBuf Name() const noexcept override {
+ return MyName;
+ }
+
+ inline size_t DoCompress(const TData& in, void* buf) const {
+ if (Level) {
+ return fastlz_compress_level(Level, in.data(), in.size(), buf);
+ }
+
+ return fastlz_compress(in.data(), in.size(), buf);
+ }
+
+ inline void DoDecompress(const TData& in, void* out, size_t len) const {
+ const int ret = fastlz_decompress(in.data(), in.size(), out, len);
+
+ if (ret < 0 || (size_t)ret != len) {
ythrow TDataError() << TStringBuf("can not decompress");
- }
- }
-
- const TString MyName;
- const int Level;
- };
-
- struct TFastLZRegistrar {
- TFastLZRegistrar() {
- for (int i = 0; i < 3; ++i) {
+ }
+ }
+
+ const TString MyName;
+ const int Level;
+ };
+
+ struct TFastLZRegistrar {
+ TFastLZRegistrar() {
+ for (int i = 0; i < 3; ++i) {
RegisterCodec(MakeHolder<TFastLZCodec>(i));
- }
- RegisterAlias("fastlz", "fastlz-0");
- }
- };
+ }
+ RegisterAlias("fastlz", "fastlz-0");
+ }
+ };
const TFastLZRegistrar Registrar{};
-}
+}