Skip to content

Main content

Protocol Buffers Enum Negative Wire Representation Tool

Compute protocol buffers enum negative wire representation from explicit bounded inputs.

Loading tool…

Description

Show a negative int32 value’s sign-extended unsigned64 argument and ten-byte varint length.

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.

Show a negative int32 value’s sign-extended unsigned64 argument and ten-byte varint length.

When to use this tool

Use Protocol Buffers Enum Negative Wire Representation when inspecting one supplied protobuf integer or key-encoding component.

How to use the tool and how it works

  1. Enter value. 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 unsigned64, bytes. Use the output convention below.

Require whole value in [-2147483648,-1]. Return its sign-extended unsigned 64-bit two's-complement representation as exact decimal unsigned64 text and bytes = 10.1

Protobuf separates keys, varints, fixed-width payloads and signed mappings. A local field transformation does not encode a complete message.2

Input fieldMeaning and unitsAccepted input
valueValueRequired. Safe integer; minimum -2147483648; maximum -1.
Output fieldInterpretationReturned shape
unsigned64Unsigned64Required. Text; maximum UTF-16 length 8192.
bytesNumber of varint octets required, always ten; not a byte array.Required. Safe integer.
json
{
  "input": {
    "value": -1
  },
  "output": {
    "unsigned64": "18446744073709551615",
    "bytes": 10
  }
}

Limitations and assumptions

  • bytes is the varint length count, not an emitted byte array. This describes negative int32 wire representation, which differs from sint32 ZigZag encoding.
  • 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/protobuf-enum-negative-wire-representation — tool.io

  2. Protocol Buffers wire encoding — Protocol Buffers

Similar or alternative tools