From 81cc688166b7c611907dcbf044e05f7412fcbd6c Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 13 Mar 2013 12:25:57 +0100 Subject: [PATCH] doc: add range for integer/long integer objects, add examples with negative numbers (relay protocol) --- doc/en/weechat_relay_protocol.en.txt | 30 ++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/doc/en/weechat_relay_protocol.en.txt b/doc/en/weechat_relay_protocol.en.txt index 2ec32ffb0..696bdae3b 100644 --- a/doc/en/weechat_relay_protocol.en.txt +++ b/doc/en/weechat_relay_protocol.en.txt @@ -1193,11 +1193,17 @@ Integer A signed integer is 4 bytes, encoded as big-endian format (most significant byte first). -Example: +Range: -2147483648 to 2147483647. + +Examples: ....................................... ┌────┬────┬────┬────┐ -│ 00 │ 00 │ 01 │ 04 │ ────► 260 (0x104) +│ 00 │ 01 │ E2 │ 40 │ ────► 123456 +└────┴────┴────┴────┘ + +┌────┬────┬────┬────┐ +│ FF │ FE │ 1D │ C0 │ ────► -123456 └────┴────┴────┴────┘ ....................................... @@ -1207,14 +1213,22 @@ Long integer A signed long integer is encoded as a string, with length on one byte. -Example: +Range: -9223372036854775808 to 9223372036854775807. + +Examples: ....................................... -┌────╥────┬────┬────┐ -│ 03 ║ 32 │ 36 │ 30 │ ────► 260 -└────╨────┴────┴────┘ - └──┘ └────────────┘ -length '2' '6' '0' +┌────╥────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐ +│ 0A ║ 31 │ 32 │ 33 │ 34 │ 35 │ 36 │ 37 │ 38 │ 39 │ 30 │ ────► 1234567890 +└────╨────┴────┴────┴────┴────┴────┴────┴────┴────┴────┘ + └──┘ └───────────────────────────────────────────────┘ +length '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' + +┌────╥────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐ +│ 0B ║ 2D │ 31 │ 32 │ 33 │ 34 │ 35 │ 36 │ 37 │ 38 │ 39 │ 30 │ ────► -1234567890 +└────╨────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┘ + └──┘ └────────────────────────────────────────────────────┘ +length '-' '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' ....................................... [[object_string]]