diff --git a/preserves.md b/preserves.md index 6850060..23dc215 100644 --- a/preserves.md +++ b/preserves.md @@ -1049,5 +1049,23 @@ Then, if `ttnn`=`0001`, `l` is the placeholder number; otherwise, `l` is the length of the body that follows, counted in bytes for `tt`=`01` and in `Repr`s for `tt`=`10`. +## Appendix. Binary SignedInteger representation + +Languages that provide fixed-width machine word types may find the +following table useful in encoding and decoding binary `SignedInteger` +values. + +| Integer range | Bytes required | Encoding (hex) | +| --- | --- | --- | +| -3 ≤ n < 13 (numbers -3..12 encoded specially) | 1 | `3X` | +| -27 ≤ n < 27 (i8) | 2 | `41` `XX` | +| -215 ≤ n < 215 (i16) | 3 | `42` `XX` `XX` | +| -223 ≤ n < 223 (i24) | 4 | `43` `XX` `XX` `XX` | +| -231 ≤ n < 231 (i32) | 5 | `44` `XX` `XX` `XX` `XX` | +| -239 ≤ n < 239 (i40) | 6 | `45` `XX` `XX` `XX` `XX` `XX` | +| -247 ≤ n < 247 (i48) | 7 | `46` `XX` `XX` `XX` `XX` `XX` `XX` | +| -255 ≤ n < 255 (i56) | 8 | `47` `XX` `XX` `XX` `XX` `XX` `XX` `XX` | +| -263 ≤ n < 263 (i64) | 9 | `48` `XX` `XX` `XX` `XX` `XX` `XX` `XX` `XX` | + ## Notes