aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/bit_io
diff options
context:
space:
mode:
authorbreakneck <breakneck@yandex-team.ru>2022-02-10 16:47:58 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:58 +0300
commite2021f9a0e54d13b7c48796318b13b66dc625e74 (patch)
tree5aed1691033eaf399ab80a10a137238922035fa8 /library/cpp/bit_io
parent83602b1b564b92a80a1526d113fa2846661dd10e (diff)
downloadydb-e2021f9a0e54d13b7c48796318b13b66dc625e74.tar.gz
Restoring authorship annotation for <breakneck@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/bit_io')
-rw-r--r--library/cpp/bit_io/bitinput.h26
-rw-r--r--library/cpp/bit_io/bitinput_impl.h16
-rw-r--r--library/cpp/bit_io/bitoutput.h8
3 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/bit_io/bitinput.h b/library/cpp/bit_io/bitinput.h
index 85711eb7f9..288f04c96f 100644
--- a/library/cpp/bit_io/bitinput.h
+++ b/library/cpp/bit_io/bitinput.h
@@ -43,7 +43,7 @@ namespace NBitIO {
// Read with static number of bits.
// Preserves what's in result.
template <ui64 bits, typename T>
- Y_FORCE_INLINE bool ReadK(T& result, ui64 skipbits) {
+ Y_FORCE_INLINE bool ReadK(T& result, ui64 skipbits) {
ui64 r64 = 0;
bool ret = bits <= 56 ? ReadKImpl<bits>(r64) : ReadSafe(r64, bits);
CopyToResultK<bits>(result, r64, skipbits);
@@ -53,7 +53,7 @@ namespace NBitIO {
// Read with static number of bits.
// Zeroes other bits in result.
template <ui64 bits, typename T>
- Y_FORCE_INLINE bool ReadK(T& result) {
+ Y_FORCE_INLINE bool ReadK(T& result) {
ui64 r = 0;
bool res = ReadK<bits>(r);
result = r;
@@ -62,7 +62,7 @@ namespace NBitIO {
// Shortcut to impl.
template <ui64 bits>
- Y_FORCE_INLINE bool ReadK(ui64& result) {
+ Y_FORCE_INLINE bool ReadK(ui64& result) {
if (bits <= 56)
return ReadKImpl<bits>(result);
@@ -80,7 +80,7 @@ namespace NBitIO {
// It's safe to read up to 64 bits.
// Zeroes other bits in result.
template <typename T>
- Y_FORCE_INLINE bool ReadSafe(T& result, ui64 bits) {
+ Y_FORCE_INLINE bool ReadSafe(T& result, ui64 bits) {
if (bits <= 56ULL)
return Read(result, bits);
@@ -98,7 +98,7 @@ namespace NBitIO {
// It's safe to read up to 64 bits.
// Preserves what's in result.
template <typename T>
- Y_FORCE_INLINE bool ReadSafe(T& result, ui64 bits, ui64 skipbits) {
+ Y_FORCE_INLINE bool ReadSafe(T& result, ui64 bits, ui64 skipbits) {
ui64 r64 = 0;
bool ret = ReadSafe(r64, bits);
CopyToResult(result, r64, bits, skipbits);
@@ -108,7 +108,7 @@ namespace NBitIO {
// Do not try to read more than 56 bits at once. Split in two reads or use ReadSafe.
// Zeroes other bits in result.
template <typename T>
- Y_FORCE_INLINE bool Read(T& result, ui64 bits) {
+ Y_FORCE_INLINE bool Read(T& result, ui64 bits) {
ui64 r64 = 0;
bool ret = ReadImpl(r64, bits);
result = r64;
@@ -116,14 +116,14 @@ namespace NBitIO {
}
// Shortcut to impl.
- Y_FORCE_INLINE bool Read(ui64& result, ui64 bits) {
+ Y_FORCE_INLINE bool Read(ui64& result, ui64 bits) {
return ReadImpl(result, bits);
}
// Do not try to read more than 56 bits at once. Split in two reads or use ReadSafe.
// Preserves what's in result.
template <typename T>
- Y_FORCE_INLINE bool Read(T& result, ui64 bits, ui64 skipbits) {
+ Y_FORCE_INLINE bool Read(T& result, ui64 bits, ui64 skipbits) {
ui64 r64 = 0;
bool ret = ReadImpl(r64, bits);
CopyToResult(result, r64, bits, skipbits);
@@ -134,7 +134,7 @@ namespace NBitIO {
// Like this: (unsigned char)0x2E<3> (0010 1110) <=> 1110 0101
// fddd fddd
template <ui64 bits, typename T>
- Y_FORCE_INLINE bool ReadWords(T& result) {
+ Y_FORCE_INLINE bool ReadWords(T& result) {
ui64 r64 = 0;
bool retCode = ReadWordsImpl<bits>(r64);
@@ -145,22 +145,22 @@ namespace NBitIO {
// Shortcut to impl.
template <ui64 bits>
- Y_FORCE_INLINE bool ReadWords(ui64& result) {
+ Y_FORCE_INLINE bool ReadWords(ui64& result) {
return ReadWordsImpl<bits>(result);
}
- Y_FORCE_INLINE bool Back(int bits) {
+ Y_FORCE_INLINE bool Back(int bits) {
return Seek(BitOffset() - bits);
}
- Y_FORCE_INLINE bool Seek(int bitoffset) {
+ Y_FORCE_INLINE bool Seek(int bitoffset) {
return TBitInputImpl::Seek(bitoffset);
}
// A way to read a portion of bits at random location.
// Didn't want to complicate sequential read, neither to copypaste.
template <typename T>
- Y_FORCE_INLINE bool ReadRandom(ui64 bitoffset, T& result, ui64 bits, ui64 skipbits) {
+ Y_FORCE_INLINE bool ReadRandom(ui64 bitoffset, T& result, ui64 bits, ui64 skipbits) {
const ui64 curr = BitOffset();
Seek(bitoffset);
bool ret = ReadSafe<T>(result, bits, skipbits);
diff --git a/library/cpp/bit_io/bitinput_impl.h b/library/cpp/bit_io/bitinput_impl.h
index b13fbef101..0a5320790c 100644
--- a/library/cpp/bit_io/bitinput_impl.h
+++ b/library/cpp/bit_io/bitinput_impl.h
@@ -32,7 +32,7 @@ namespace NBitIO {
protected:
template <ui32 bits>
- Y_FORCE_INLINE bool ReadKImpl(ui64& result) {
+ Y_FORCE_INLINE bool ReadKImpl(ui64& result) {
result = (ReadUnaligned<ui64>((const void*)(Start + (BOffset >> 3))) >> (BOffset & 7)) & Mask64(bits);
BOffset += bits;
if (BOffset < FakeStart)
@@ -46,7 +46,7 @@ namespace NBitIO {
return true;
}
- Y_FORCE_INLINE bool ReadImpl(ui64& result, ui32 bits) {
+ Y_FORCE_INLINE bool ReadImpl(ui64& result, ui32 bits) {
result = (ReadUnaligned<ui64>((const void*)(Start + (BOffset >> 3))) >> (BOffset & 7)) & MaskLowerBits(bits);
BOffset += bits;
if (BOffset < FakeStart)
@@ -60,15 +60,15 @@ namespace NBitIO {
return true;
}
- Y_FORCE_INLINE bool EofImpl() const {
+ Y_FORCE_INLINE bool EofImpl() const {
return BOffset >= Length;
}
- Y_FORCE_INLINE ui64 BitOffset() const {
+ Y_FORCE_INLINE ui64 BitOffset() const {
return BOffset;
}
- Y_FORCE_INLINE bool Seek(i64 offset) {
+ Y_FORCE_INLINE bool Seek(i64 offset) {
if (offset < 0 || offset > (i64)Length)
return false;
BOffset = offset;
@@ -78,18 +78,18 @@ namespace NBitIO {
protected:
template <ui64 bits, typename T>
- Y_FORCE_INLINE static void CopyToResultK(T& result, ui64 r64, ui64 skipbits) {
+ Y_FORCE_INLINE static void CopyToResultK(T& result, ui64 r64, ui64 skipbits) {
result = (result & ~(Mask64(bits) << skipbits)) | (r64 << skipbits);
}
template <typename T>
- Y_FORCE_INLINE static void CopyToResult(T& result, ui64 r64, ui64 bits, ui64 skipbits) {
+ Y_FORCE_INLINE static void CopyToResult(T& result, ui64 r64, ui64 bits, ui64 skipbits) {
result = (result & InverseMaskLowerBits(bits, skipbits)) | (r64 << skipbits);
}
public:
template <ui64 bits>
- Y_FORCE_INLINE bool ReadWordsImpl(ui64& data) {
+ Y_FORCE_INLINE bool ReadWordsImpl(ui64& data) {
data = 0;
const ui64 haveMore = NthBit64(bits);
diff --git a/library/cpp/bit_io/bitoutput.h b/library/cpp/bit_io/bitoutput.h
index 2b886c1f02..edadc5da0c 100644
--- a/library/cpp/bit_io/bitoutput.h
+++ b/library/cpp/bit_io/bitoutput.h
@@ -51,7 +51,7 @@ namespace NBitIO {
// interface
// Write "bits" lower bits.
- Y_FORCE_INLINE void Write(ui64 data, ui64 bits) {
+ Y_FORCE_INLINE void Write(ui64 data, ui64 bits) {
if (FreeBits < bits) {
if (FreeBits) {
bits -= FreeBits;
@@ -70,7 +70,7 @@ namespace NBitIO {
}
// Write "bits" lower bits starting from "skipbits" bit.
- Y_FORCE_INLINE void Write(ui64 data, ui64 bits, ui64 skipbits) {
+ Y_FORCE_INLINE void Write(ui64 data, ui64 bits, ui64 skipbits) {
Write(data >> skipbits, bits);
}
@@ -78,7 +78,7 @@ namespace NBitIO {
// Like this: (unsigned char)0x2E<3> (0000 0010 1110) <=> 1110 0101
// fddd fddd
template <ui64 bits>
- Y_FORCE_INLINE void WriteWords(ui64 data) {
+ Y_FORCE_INLINE void WriteWords(ui64 data) {
do {
ui64 part = data;
@@ -88,7 +88,7 @@ namespace NBitIO {
} while (data);
}
- Y_FORCE_INLINE ui64 /* padded bits */ Flush() {
+ Y_FORCE_INLINE ui64 /* padded bits */ Flush() {
const ui64 ubytes = 8ULL - (FreeBits >> 3ULL);
if (ubytes) {