Skip to content

Commit

Permalink
Add signed_vint::serialized_size_from_first_byte
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
  • Loading branch information
Piotr Jastrzebski committed May 9, 2018
1 parent 5894631 commit b602dea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vint-serialization.cc
Expand Up @@ -89,6 +89,10 @@ signed_vint::deserialized_type signed_vint::deserialize(bytes_view v) {
return deserialized_type{decode_zigzag(un.value), un.size};
}

vint_size_type signed_vint::serialized_size_from_first_byte(bytes::value_type first_byte) {
return unsigned_vint::serialized_size_from_first_byte(first_byte);
}

// The number of additional bytes that we need to read.
static vint_size_type count_extra_bytes(int8_t first_byte) {
// Sign extension.
Expand Down
2 changes: 2 additions & 0 deletions vint-serialization.hh
Expand Up @@ -63,4 +63,6 @@ struct signed_vint final {
static vint_size_type serialize(value_type, bytes::iterator out);

static deserialized_type deserialize(bytes_view v);

static vint_size_type serialized_size_from_first_byte(bytes::value_type first_byte);
};

0 comments on commit b602dea

Please sign in to comment.