Skip to content

Commit b7430e8

Browse files
committed
Documentation for int{n} support
1 parent 9ae5b52 commit b7430e8

File tree

5 files changed

+260
-197
lines changed

5 files changed

+260
-197
lines changed

changes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
.. _version-0.4.6:
44

5+
Version 0.4.6
6+
-------------
7+
58
- Support signed integers with arbitrary bits, e.g. int24 PR#45.
69

710
.. _version-0.4.5:

docs/language.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,22 @@ An overview of bitproto basic types:
3838
``uint{n}``
3939
| Unsigned bit-level integer type, where ``n`` ranges from ``1`` to ``64``.
4040
For examples: ``uint3``, ``uint13``, ``uint41``, ``uint64`` are all supported.
41-
An unsigned integer ``uint{n}`` occupies extactly ``n`` bits after encoding.
41+
An unsigned integer ``uint{n}`` occupies exactly ``n`` bits after encoding.
4242
In code generation, ``uint{n}`` is mapped to the smallest type in target language
4343
that can cover its size, for examples for C, ``uint3`` maps to ``uint8_t``, ``uint13``
4444
maps to ``uint16_t`` and so on.
4545
46-
``int{8,16,32,64}``
47-
| Signed integers. It's different from unsigned
48-
integers that only four signed integer types are supported:
49-
``int8``, ``int16``, ``int32``, ``int64``. Signed integers with non-integer number
50-
of bytes are not supported.
51-
For examples, ``int16`` is valid, but ``int3`` is not.
52-
A signed integer ``int{n}`` occupies ``n`` bits after encoded.,
46+
``int{n}``
47+
| Signed bit-level integers, where ``n`` ranges from ``1`` to ``64``.
48+
For examples: ``int24``, ``int32``, ``int64`` are all supported.
49+
A signed integer ``int{n}`` occupies exactly ``n`` bits after encoding.
50+
Similar to ``uint{n}``, in code generation, ``int{n}`` is mapped to the smallest type in target language
51+
that can cover its size, for examples for C, ``int3`` maps to ``int8_t``, ``int13``
52+
maps to ``int16_t`` and so on.
53+
For a bitproto signed integer ``int{n}``, the ``nth`` bit is considered the sign bit, for instance,
54+
the ``24th`` bit is the sign bit for a ``int24`` integer.
55+
For bitproto <= v0.4.5, only ``int8,int16,int32,int64`` are supported.
56+
But since bitproto 0.4.6, signed integers with arbitrary bits are supported.
5357
5458
``byte``
5559
| Byte type. A byte value occupies 8 bits.

docs/locales/zh/LC_MESSAGES/changelog.po

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,54 +8,68 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: bitproto 0.4.0\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2022-02-24 10:21+0800\n"
11+
"POT-Creation-Date: 2022-12-13 22:41+0800\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
1515
"MIME-Version: 1.0\n"
1616
"Content-Type: text/plain; charset=utf-8\n"
1717
"Content-Transfer-Encoding: 8bit\n"
18-
"Generated-By: Babel 2.9.1\n"
18+
"Generated-By: Babel 2.11.0\n"
1919

20-
#: ../../changelog.rst:2 c3aafa1b86fb4406b8ad619f3bedb8d3
20+
#: ../../changelog.rst:2 eb5e577b5cca451f97c84e6697bf5395
2121
msgid "Changelog"
2222
msgstr "版本历史"
2323

24-
#: ../../../changes.rst:6 0d36e7c261c74f93925a9d1cac8e349c
24+
#: ../../../changes.rst:5 9e9740e4c92e4ed595194bd543ebe147
25+
msgid "Support signed integers with arbitrary bits, e.g. int24 PR#45."
26+
msgstr "支持任意比特数目的有符号整数类型 例如 int24, 见 PR#45"
27+
28+
#: ../../../changes.rst:10 30bc2f453f9a4e4daec1f2b082a6ac91
29+
msgid "Version 0.4.5"
30+
msgstr ""
31+
32+
#: ../../../changes.rst:12 3ba33408fbab4e6e8fa4bd1348e776a9
33+
msgid ""
34+
"Use Python IntEnum for enum generation (respecting backward "
35+
"compatibility) PR#41."
36+
msgstr ""
37+
38+
#: ../../../changes.rst:17 dc7770b7fd674da18fa53f58fea0f06f
2539
msgid "Version 0.4.4"
2640
msgstr ""
2741

28-
#: ../../../changes.rst:8 6e50f748d8ad43cd83147fd3ad35c103
42+
#: ../../../changes.rst:19 ee1e046b6272442181a755b5b744d6ba
2943
msgid "Minor fix compiler setup.py path issue."
3044
msgstr ""
3145

32-
#: ../../../changes.rst:13 0d36e7c261c74f93925a9d1cac8e349c
46+
#: ../../../changes.rst:24 2cd432670b154c19a01259f94cb33bc3
3347
msgid "Version 0.4.2"
3448
msgstr ""
3549

36-
#: ../../../changes.rst:15 45ad5c975eee4893a337aa1148e9f843
50+
#: ../../../changes.rst:26 a8406cdecd1d4dfc94ad9cebc4c927b5
3751
msgid "Allow using ``type`` as message field name, fixes issue #39."
3852
msgstr ""
3953

40-
#: ../../../changes.rst:20 0d36e7c261c74f93925a9d1cac8e349c
54+
#: ../../../changes.rst:31 fc5a94d17a314c589b3622ad0c32e5a0
4155
msgid "Version 0.4.0"
4256
msgstr ""
4357

44-
#: ../../../changes.rst:22 1f9f362e8f19439e80853d2c8e0be167
58+
#: ../../../changes.rst:33 3c499990cd38434f932a3558376617c5
4559
msgid ""
4660
"Add support for ``message`` and ``enum`` extensiblity for protocol "
4761
"backward compatibility."
4862
msgstr ""
4963

50-
#: ../../../changes.rst:23 fd9a84c95ed546a59f5268431d877be9
64+
#: ../../../changes.rst:34 ad10bcd6f05a4e5187b2d8ba2f3e5235
5165
msgid "Cut down the code size of generated language-specific files."
5266
msgstr ""
5367

54-
#: ../../../changes.rst:24 ccade2fb15534d4bb0569dc800abb83f
68+
#: ../../../changes.rst:35 a2e47a95cb5c4f44ac3a9d965d8d719c
5569
msgid "Refactor the bitproto compiler."
5670
msgstr ""
5771

58-
#: ../../../changes.rst:25 2f3010514fd244ef99981b9cbc69e934
72+
#: ../../../changes.rst:36 480040dd74284c97acfb4dcc47354779
5973
msgid ""
6074
"Refactor the bitproto serialization mechanism, using language-specific "
6175
"libraries instead of pure compiler-generated files."

0 commit comments

Comments
 (0)