Description
Return CBOR’s exact unsigned argument for one supported negative integer.
CBOR combines a three-bit major type with additional information in an initial byte. Negative integers use an unsigned argument related by -1-n, while simple values and break markers have distinct meanings.
Return CBOR’s exact unsigned argument for one supported negative integer.
When to use this tool
Use CBOR Negative Integer Initial Argument when checking one CBOR initial-byte, simple-value or negative-integer argument.
How to use the tool and how it works
- Enter integer. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read argument. Use the output convention below.
Parse an exact negative decimal integer n in [-18446744073709551616,-1]. Return argument = -1-n as exact decimal text.1
CBOR type and argument conventions determine the encoded value. Constructing one argument or initial byte does not validate a full item.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| integer | Integer | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| argument | Argument | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"integer": "-25"
},
"output": {
"argument": "24"
}
} Limitations and assumptions
- This returns the unsigned argument for CBOR major type 1, not the integer's absolute value or its complete byte encoding. Larger negative bignums need a different representation.
- 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.
Alternative or Complementary methods
Use a complete CBOR encoder or decoder to check type-specific validity, following arguments and complete item structure.
References
-
Calculation and input contract: encode/cbor-negative-integer-initial-argument — tool.io
-
Concise Binary Object Representation: RFC 8949 — Internet Engineering Task Force
Similar or alternative tools
- CBOR Small Integer Initial Octet
Return octet = value+(negative ? 32 : 0).
- CBOR Simple Value Initial Octet
Encode a CBOR simple-value code while rejecting reserved values 24 through 31.