From 5d0bf91d303d4e5312ada896b19040d7c69ca374 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 15 Oct 2023 01:04:01 +0200 Subject: [PATCH] Repair varint() definition in cheatsheet --- _includes/cheatsheet-binary.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/_includes/cheatsheet-binary.md b/_includes/cheatsheet-binary.md index d9d2260..19197f0 100644 --- a/_includes/cheatsheet-binary.md +++ b/_includes/cheatsheet-binary.md @@ -19,10 +19,8 @@ For a value `V`, we write `«V»` for the binary encoding of `V`. «#{E_1...E_m}» = [0xB6] ++ «E_1» ++...++ «E_m» ++ [0x84] «{K_1:V_1...K_m:V_m}» = [0xB7] ++ «K_1» ++ «V_1» ++...++ «K_m» ++ «V_m» ++ [0x84] - varint(v) = e(v, 128) - - e(v, d) = [v + d] if v < 128 - e(v >> 7, 0) ++ [(v & 0x7F) + d] if v ≥ 128 + varint(v) = [v] if v < 128 + [(v & 0x7F) + 128] ++ varint(v >> 7) if v ≥ 128 The functions `binary32(F)` and `binary64(D)` yield big-endian 4- and 8-byte IEEE 754 binary representations of `F` and `D`, respectively.