Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Dec 19, 2015
1 parent ba7f2db commit c0f2425
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ a float, a boolean and a bytearray:
>>> calcsize('u5s5f32b1r13')
56
The same format and values as in the previous example, but using LSB
(Least Significant Bit) first instead of the default MSB (Most
Significant Bit) first:

.. code-block:: python
>>> from bitstruct import *
>>> pack('<u5s5f32b1r13', 1, -1, 3.75, True, bytearray(b'\xff\xff'))
bytearray(b'\x87\xc0\x00\x03\x80\xbf\xff')
>>> unpack('<u5s5f32b1r13', bytearray(b'\x87\xc0\x00\x03\x80\xbf\xff'))
(1, -1, 3.75, True, bytearray(b'\xff\xf8'))
>>> calcsize('<u5s5f32b1r13')
56
An example of unpacking values from a hexstring and a binary file:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

setup(name='bitstruct',
version='2.1.0',
version='2.1.1',
description=('This module performs conversions between Python values '
'and C bit field structs represented as Python '
'bytearrays.'),
Expand Down

0 comments on commit c0f2425

Please sign in to comment.