Skip to content

Commit 5290dc3

Browse files
committed
Added CBOR_NEGATIVE_INT_MAX disallowed.
1 parent 61440ef commit 5290dc3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

draft-mcnally-deterministic-cbor.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ Similarly, encoders that support floating point MUST reduce all `+INF` values to
149149

150150
While there is no requirement that dCBOR codecs implement support for BigNums ≥ 2^64 (tags 2 and 3), codecs that do support them MUST use regular integer encodings where integers can represent the value.
151151

152+
## CBOR_NEGATIVE_INT_MAX disallowed
153+
154+
The largest negative integer that can be represented in 64 bits two's complement (STANDARD_NEGATIVE_INT_MAX) is -2^63 (0x8000000000000000).
155+
156+
However, the largest negative integer that can be represented in CBOR (CBOR_NEGATIVE_INT_MAX) is -2^64 (0x10000000000000000), which requires 65 bits. The CBOR encoding for CBOR_NEGATIVE_INT_MAX is 0x3BFFFFFFFFFFFFFFFF.
157+
158+
Because of this incompatibility between the CBOR and standard representations, dCBOR disallows CBOR_NEGATIVE_INT_MAX: conformant encoders MUST never encode this sequence and conformant decoders MUST reject CBOR_NEGATIVE_INT_MAX as not well-formed.
159+
160+
Implementations that support BIGNUM are able to encode and decode this value as BIGNUM.
161+
152162
## API Handling of Maps
153163

154164
dCBOR APIs SHOULD provide a dCBOR `Map` structure or similar that models the dCBOR canonical key encoding and order.

0 commit comments

Comments
 (0)