Skip to content

Main content

Varint Seven Bit Group Writer Tool

Construct one unsigned base-128 varint octet from an explicit seven-bit group and continuation flag.

Loading tool…

Description

Construct one varint octet and lowercase hex spelling from a seven-bit payload and continuation flag.

Protocol Buffer integer fields separate a numeric key, signed-value mapping and byte representation. Varint groups carry seven payload bits plus continuation, while ZigZag and sign-extended integer types represent negative values differently.

Construct one varint octet and lowercase hex spelling from a seven-bit payload and continuation flag.

When to use this tool

Use Varint Seven Bit Group Writer when inspecting one supplied protobuf integer or key-encoding component.

How to use the tool and how it works

  1. Enter payload, moreGroups. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read byte, hex. Use the output convention below.

Require whole payload in [0,127]. byte = payload+(moreGroups ? 128 : 0); hex is its two-digit lowercase hexadecimal spelling.1

Input fieldMeaning and unitsAccepted input
payloadPayloadRequired. Safe integer; minimum 0; maximum 127.
moreGroupsWhether the high continuation bit is set to signal a following group.Required. Boolean.
Output fieldInterpretationReturned shape
byteByteRequired. Safe integer.
hexHexRequired. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "payload": 44,
    "moreGroups": true
  },
  "output": {
    "byte": 172,
    "hex": "ac"
  }
}

Limitations and assumptions

  • moreGroups controls the continuation bit and must reflect the actual surrounding encoding. The tool does not split a larger value into groups or check canonical termination.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use a conforming complete serializer and message schema for full wire encoding, payload validation and interoperability.

References

  1. Calculation and input contract: encode/varint-seven-bit-group-writer — tool.io

Similar or alternative tools