aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson/varint.cpp
diff options
context:
space:
mode:
authormonster <monster@yandex-team.ru>2022-02-10 16:47:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:19 +0300
commitb23c1d7a8015c2006a148fd93b84cdeb0aee17a3 (patch)
tree9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/yson/varint.cpp
parentdd76ae1f6213d065375ab296699f764faafbe5bd (diff)
downloadydb-b23c1d7a8015c2006a148fd93b84cdeb0aee17a3.tar.gz
Restoring authorship annotation for <monster@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yson/varint.cpp')
-rw-r--r--library/cpp/yson/varint.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/library/cpp/yson/varint.cpp b/library/cpp/yson/varint.cpp
index b962dcede7..d538ee3cff 100644
--- a/library/cpp/yson/varint.cpp
+++ b/library/cpp/yson/varint.cpp
@@ -1,12 +1,12 @@
#include "varint.h"
-#include "zigzag.h"
-
+#include "zigzag.h"
+
#include <util/generic/yexception.h>
-
+
namespace NYson {
////////////////////////////////////////////////////////////////////////////////
-
+
int WriteVarUInt64(IOutputStream* output, ui64 value) {
bool stop = false;
int bytesWritten = 0;
@@ -19,22 +19,22 @@ namespace NYson {
byte &= 0x7F;
}
output->Write(byte);
- }
+ }
return bytesWritten;
- }
-
+ }
+
int WriteVarInt32(IOutputStream* output, i32 value) {
return WriteVarUInt64(output, static_cast<ui64>(ZigZagEncode32(value)));
}
-
+
int WriteVarInt64(IOutputStream* output, i64 value) {
return WriteVarUInt64(output, static_cast<ui64>(ZigZagEncode64(value)));
}
-
+
int ReadVarUInt64(IInputStream* input, ui64* value) {
size_t count = 0;
ui64 result = 0;
-
+
ui8 byte = 0;
do {
if (7 * count > 8 * sizeof(ui64)) {
@@ -56,16 +56,16 @@ namespace NYson {
int bytesRead = ReadVarUInt64(input, &varInt);
if (varInt > Max<ui32>()) {
ythrow yexception() << "The data is too long to read ui64";
- }
+ }
*value = ZigZagDecode32(static_cast<ui32>(varInt));
return bytesRead;
}
-
+
int ReadVarInt64(IInputStream* input, i64* value) {
ui64 varInt;
int bytesRead = ReadVarUInt64(input, &varInt);
*value = ZigZagDecode64(varInt);
return bytesRead;
- }
-
+ }
+
} // namespace NYson