diff options
author | Alexander Fokin <apfokin@gmail.com> | 2022-02-10 16:45:38 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:38 +0300 |
commit | bf9e69a933f89af083d895185f01ed65e4d90766 (patch) | |
tree | b2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /library/cpp/bit_io | |
parent | 863a59a65247c24db7cb06789bc5cf79d04da32f (diff) | |
download | ydb-bf9e69a933f89af083d895185f01ed65e4d90766.tar.gz |
Restoring authorship annotation for Alexander Fokin <apfokin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/bit_io')
-rw-r--r-- | library/cpp/bit_io/bitinout_ut.cpp | 52 | ||||
-rw-r--r-- | library/cpp/bit_io/bitinput.h | 6 | ||||
-rw-r--r-- | library/cpp/bit_io/bitoutput.h | 10 |
3 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/bit_io/bitinout_ut.cpp b/library/cpp/bit_io/bitinout_ut.cpp index b678c422c3..23a1ddf344 100644 --- a/library/cpp/bit_io/bitinout_ut.cpp +++ b/library/cpp/bit_io/bitinout_ut.cpp @@ -14,35 +14,35 @@ namespace NBitIO { "00001010 10101010 10101010 10101010 10101010 10101010 10101010 10101010 " "10110101 01010101 01010101 01010101 01010101 01010101 01010101 01010101 " "01000000"; - - inline ui64 Bits(ui64 bytes) { - return bytes << 3ULL; - } - + + inline ui64 Bits(ui64 bytes) { + return bytes << 3ULL; + } + inline TString PrintBits(const char* a, const char* b, bool reverse = false) { TString s; - TStringOutput out(s); - for (const char* it = a; it != b; ++it) { - if (it != a) - out << ' '; - - ui8 byte = *it; - - if (reverse) - byte = ReverseBits(byte); - - for (ui32 mask = 1; mask < 0xff; mask <<= 1) { - out << ((byte & mask) ? '1' : '0'); - } - } - - return s; - } - - template <typename T> + TStringOutput out(s); + for (const char* it = a; it != b; ++it) { + if (it != a) + out << ' '; + + ui8 byte = *it; + + if (reverse) + byte = ReverseBits(byte); + + for (ui32 mask = 1; mask < 0xff; mask <<= 1) { + out << ((byte & mask) ? '1' : '0'); + } + } + + return s; + } + + template <typename T> inline TString PrintBits(T t, ui32 bits = Bits(sizeof(T))) { - return PrintBits((char*)&t, ((char*)&t) + BytesUp(bits)); - } + return PrintBits((char*)&t, ((char*)&t) + BytesUp(bits)); + } } class TBitIOTest: public TTestBase { diff --git a/library/cpp/bit_io/bitinput.h b/library/cpp/bit_io/bitinput.h index 7c198bbff1..85711eb7f9 100644 --- a/library/cpp/bit_io/bitinput.h +++ b/library/cpp/bit_io/bitinput.h @@ -6,8 +6,8 @@ #include <util/generic/vector.h> #include <util/generic/yexception.h> -#include <iterator> - +#include <iterator> + namespace NBitIO { // Based on junk/solar/codecs/bitstream.h @@ -15,7 +15,7 @@ namespace NBitIO { public: template <typename TVec> explicit TBitInput(const TVec& vec) - : TBitInputImpl(std::begin(vec), std::end(vec)) + : TBitInputImpl(std::begin(vec), std::end(vec)) { } diff --git a/library/cpp/bit_io/bitoutput.h b/library/cpp/bit_io/bitoutput.h index 29eb28034a..2b886c1f02 100644 --- a/library/cpp/bit_io/bitoutput.h +++ b/library/cpp/bit_io/bitoutput.h @@ -110,11 +110,11 @@ namespace NBitIO { virtual ~TBitOutputBase() { Flush(); } - - private: - static Y_FORCE_INLINE ui64 FastZeroIfFalse(bool cond, ui64 iftrue) { - return -i64(cond) & iftrue; - } + + private: + static Y_FORCE_INLINE ui64 FastZeroIfFalse(bool cond, ui64 iftrue) { + return -i64(cond) & iftrue; + } }; template <typename TVec> |