Please add documentation of the bitfield ordering for ctypes.Structure types
オープン
まだ誰も着手していません。
docs
topic-ctypes
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Documentation
The current documentation for ctypes bit fields is very limited and doesn't cover the definition order. AFAICT this is:
Little endian - LSB first -> MSB last
Big endian - MSB first -> LSB last
Native - ??? This is LSB first -> MSB last on x86 but is that just because it's a little endian architecture?
For example:
class BigOnes(BigEndianStructure):
_pack_ = 1
_fields_ = (
("bit_0", c_uint16, 1), # MSBit
("bit_1", c_uint16, 1),
("bit_2", c_uint16, 1),
("bit_3", c_uint16, 1),
("nibble_1", c_uint16, 4),
("nibble_2", c_uint16, 4),
("nibble_3", c_uint16, 4), # LSBit
("byte_3", c_uint16, 8), # MSByte
("byte_4", c_uint16, 8), # LSByte
)
Versus:
class LittleOnes(LittleEndianStructure):
_pack_ = 1
_fields_ = (
("bit_0", c_uint16, 1), # LSBit
("bit_1", c_uint16, 1),
("bit_2", c_uint16, 1),
("bit_3", c_uint16, 1),
("nibble_1", c_uint16, 4),
("nibble_2", c_uint16, 4),
("nibble_3", c_uint16, 4), # MSBit
("byte_3", c_uint16, 8), # LSByte
("byte_4", c_uint16, 8), # MSByte
)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Structure、BigEndianStructure、LittleEndianStructure に関する ctypes のドキュメントから始め、提示されたビットフィールドの例を説明対象のケースとして使用します。リトルエンディアン、ビッグエンディアン、およびネイティブの構造体について、アーキテクチャ依存の動作を含む定義順序を特定して文書化し、結果のテキストに曖昧さがないことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100