Simplify text further
This commit is contained in:
parent
0cdcc1d8e7
commit
6cbfefc76d
|
@ -5,8 +5,8 @@ For a value `V`, we write `«V»` for the binary encoding of `V`.
|
||||||
|
|
||||||
«#!V» = [0x86] ++ «V»
|
«#!V» = [0x86] ++ «V»
|
||||||
|
|
||||||
«V» if V ∈ Float = [0x87] ++ varint(|binary32(V)|) ++ binary32(V)
|
«V» if V ∈ Float = [0x87, 0x04] ++ binary32(V)
|
||||||
«V» if V ∈ Double = [0x87] ++ varint(|binary64(V)|) ++ binary64(V)
|
«V» if V ∈ Double = [0x87, 0x08] ++ binary64(V)
|
||||||
|
|
||||||
«V» if V ∈ SignedInteger = [0xB0] ++ varint(|intbytes(V)|) ++ intbytes(V)
|
«V» if V ∈ SignedInteger = [0xB0] ++ varint(|intbytes(V)|) ++ intbytes(V)
|
||||||
«V» if V ∈ String = [0xB1] ++ varint(|utf8(V)|) ++ utf8(V)
|
«V» if V ∈ String = [0xB1] ++ varint(|utf8(V)|) ++ utf8(V)
|
||||||
|
@ -28,10 +28,10 @@ The functions `binary32(F)` and `binary64(D)` yield big-endian 4- and
|
||||||
|
|
||||||
The function `intbytes(x)` is a big-endian two's-complement signed binary representation of
|
The function `intbytes(x)` is a big-endian two's-complement signed binary representation of
|
||||||
`x`, taking exactly as many whole bytes as needed to unambiguously identify the value and its
|
`x`, taking exactly as many whole bytes as needed to unambiguously identify the value and its
|
||||||
sign; in particular, `intbytes(0)` is the empty byte sequence.
|
sign. In particular, `intbytes(0)` is the empty byte sequence.
|
||||||
|
|
||||||
**Annotations.** To annotate an encoded value `«V»` (that *MUST NOT* itself already be
|
**Annotations.** To annotate an encoded value `«V»` (which *MUST NOT* itself already be
|
||||||
annotated) with some sequence of `Value`s `V_1...V_m` (that *MUST* be non-empty),
|
annotated) with some sequence of `Value`s `V_1...V_m` (which *MUST* be non-empty),
|
||||||
surround `«V»` as follows:
|
surround `«V»` as follows:
|
||||||
|
|
||||||
«@V_1...@V_m V» = [0xBF] ++ «V» ++ «V_1» ++...++ «V_m» ++ [0x84]
|
«@V_1...@V_m V» = [0xBF] ++ «V» ++ «V_1» ++...++ «V_m» ++ [0x84]
|
||||||
|
|
|
@ -103,19 +103,7 @@ binary representation of `x`, taking exactly as many whole bytes as
|
||||||
needed to unambiguously identify the value and its sign. The value 0
|
needed to unambiguously identify the value and its sign. The value 0
|
||||||
needs zero bytes to identify the value; non-zero values need at least
|
needs zero bytes to identify the value; non-zero values need at least
|
||||||
one byte, and the most-significant bit in the first byte is the sign
|
one byte, and the most-significant bit in the first byte is the sign
|
||||||
bit. For example,
|
bit. See the [examples in the appendix below](#signedinteger-examples).
|
||||||
|
|
||||||
«-257» = B0 02 FE FF «-2» = B0 01 FE «255» = B0 02 00 FF
|
|
||||||
«-256» = B0 02 FF 00 «-1» = B0 01 FF «256» = B0 02 01 00
|
|
||||||
«-255» = B0 02 FF 01 «0» = B0 00 «32767» = B0 02 7F FF
|
|
||||||
«-129» = B0 02 FF 7F «1» = B0 01 01 «32768» = B0 03 00 80 00
|
|
||||||
«-128» = B0 01 80 «127» = B0 01 7F «65535» = B0 03 00 FF FF
|
|
||||||
«-127» = B0 01 81 «128» = B0 02 00 80 «65536» = B0 03 01 00 00
|
|
||||||
|
|
||||||
«87112285931760246646623899502532662132736»
|
|
||||||
= B0 12 01 00 00 00 00 00 00 00
|
|
||||||
00 00 00 00 00 00 00 00
|
|
||||||
00 00
|
|
||||||
|
|
||||||
### Strings, ByteStrings and Symbols.
|
### Strings, ByteStrings and Symbols.
|
||||||
|
|
||||||
|
@ -195,16 +183,9 @@ a binary-syntax document; otherwise, it should be interpreted as text.
|
||||||
|
|
||||||
80 - False
|
80 - False
|
||||||
81 - True
|
81 - True
|
||||||
(82) RESERVED
|
|
||||||
(83) RESERVED
|
|
||||||
84 - End marker
|
84 - End marker
|
||||||
(85) RESERVED
|
|
||||||
86 - Embedded
|
86 - Embedded
|
||||||
87 - Float and Double
|
87 - Float and Double
|
||||||
(8x) RESERVED 88-8F
|
|
||||||
|
|
||||||
(9x) RESERVED
|
|
||||||
(Ax) RESERVED
|
|
||||||
|
|
||||||
B0 - Integer
|
B0 - Integer
|
||||||
B1 - String
|
B1 - String
|
||||||
|
@ -215,9 +196,12 @@ a binary-syntax document; otherwise, it should be interpreted as text.
|
||||||
B6 - Set
|
B6 - Set
|
||||||
B7 - Dictionary
|
B7 - Dictionary
|
||||||
|
|
||||||
(Bx) RESERVED B8-BE
|
|
||||||
BF - Annotated Repr (not itself starting with BF) followed by annotations
|
BF - Annotated Repr (not itself starting with BF) followed by annotations
|
||||||
|
|
||||||
|
All tags fall in the range [`0x80`, `0xBF`].
|
||||||
|
|
||||||
|
Tag values `82`, `83`, `85`, `88`...`AF`, and `B8`...`BE` are **reserved**.
|
||||||
|
|
||||||
## Appendix. Binary SignedInteger representation
|
## Appendix. Binary SignedInteger representation
|
||||||
|
|
||||||
Languages that provide fixed-width machine word types may find the
|
Languages that provide fixed-width machine word types may find the
|
||||||
|
@ -236,5 +220,19 @@ values.
|
||||||
| -2<sup>55</sup> ≤ n < 2<sup>55</sup> (i56) | 9 | `B0` `07` `XX` `XX` `XX` `XX` `XX` `XX` `XX` |
|
| -2<sup>55</sup> ≤ n < 2<sup>55</sup> (i56) | 9 | `B0` `07` `XX` `XX` `XX` `XX` `XX` `XX` `XX` |
|
||||||
| -2<sup>63</sup> ≤ n < 2<sup>63</sup> (i64) | 10 | `B0` `08` `XX` `XX` `XX` `XX` `XX` `XX` `XX` `XX` |
|
| -2<sup>63</sup> ≤ n < 2<sup>63</sup> (i64) | 10 | `B0` `08` `XX` `XX` `XX` `XX` `XX` `XX` `XX` `XX` |
|
||||||
|
|
||||||
|
## <a id="signedinteger-examples"></a>Appendix. Binary SignedInteger examples
|
||||||
|
|
||||||
|
«-257» = B0 02 FE FF «-2» = B0 01 FE «255» = B0 02 00 FF
|
||||||
|
«-256» = B0 02 FF 00 «-1» = B0 01 FF «256» = B0 02 01 00
|
||||||
|
«-255» = B0 02 FF 01 «0» = B0 00 «32767» = B0 02 7F FF
|
||||||
|
«-129» = B0 02 FF 7F «1» = B0 01 01 «32768» = B0 03 00 80 00
|
||||||
|
«-128» = B0 01 80 «127» = B0 01 7F «65535» = B0 03 00 FF FF
|
||||||
|
«-127» = B0 01 81 «128» = B0 02 00 80 «65536» = B0 03 01 00 00
|
||||||
|
|
||||||
|
«87112285931760246646623899502532662132736»
|
||||||
|
= B0 12 01 00 00 00 00 00 00 00
|
||||||
|
00 00 00 00 00 00 00 00
|
||||||
|
00 00
|
||||||
|
|
||||||
<!-- Heading to visually offset the footnotes from the main document: -->
|
<!-- Heading to visually offset the footnotes from the main document: -->
|
||||||
## Notes
|
## Notes
|
||||||
|
|
Loading…
Reference in New Issue