MCPcopy Create free account
hub / github.com/apache/fory / read_var_uint64

Method read_var_uint64

cpp/fory/util/buffer.h:1050–1065  ·  view source on GitHub ↗

Read uint64_t value as varint from buffer. Sets error on bounds violation.

Source from the content-addressed store, hash-verified

1048
1049 /// Read uint64_t value as varint from buffer. Sets error on bounds violation.
1050 FORY_ALWAYS_INLINE uint64_t read_var_uint64(Error &error) {
1051 if (FORY_PREDICT_FALSE(!ensure_readable(1, error))) {
1052 return 0;
1053 }
1054 if (FORY_PREDICT_FALSE(size_ - reader_index_ < 9)) {
1055 return read_var_uint64_slow(error);
1056 }
1057 uint32_t read_bytes = 0;
1058 uint64_t value = get_var_uint64(reader_index_, &read_bytes);
1059 if (FORY_PREDICT_FALSE(read_bytes == 0)) {
1060 error.set_buffer_out_of_bound(reader_index_, 1, size_);
1061 return 0;
1062 }
1063 reader_index_ += read_bytes;
1064 return value;
1065 }
1066
1067 /// Read int64_t value as varint (zigzag encoded). Sets error on bounds
1068 /// violation.

Callers 1

TESTFunction · 0.45

Calls 1

Tested by 1

TESTFunction · 0.36