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
- Enter value. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| value | Value | Required. Safe integer; minimum -2147483648; maximum -1. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| unsigned64 | Unsigned64 | Required. Text; maximum UTF-16 length 8192. |
| bytes | Number of varint octets required, always ten; not a byte array. | Required. Safe integer. |
{
"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
-
Calculation and input contract: encode/protobuf-enum-negative-wire-representation — tool.io
-
Protocol Buffers wire encoding — Protocol Buffers
Similar or alternative tools
- Encoding: Protocol Buffers Wire Key Scalar Fields
Return wireKey = fieldNumber*8+wireType.
- Protocol Buffers Fixed32 Octet Fields
Return four octets floor(value/256^i) modulo 256 for i = 0,1,2,3, in least-significant-byte-first order.