diff options
Diffstat (limited to '.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info')
7 files changed, 212 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/AUTHORS b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/AUTHORS new file mode 100644 index 00000000..e93c04c7 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/AUTHORS @@ -0,0 +1,3 @@ +fixedint is written and maintained by +Robert Xiao <robert.bo.xiao@gmail.com> + diff --git a/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/INSTALLER b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/INSTALLER new file mode 100644 index 00000000..a1b589e3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/LICENSE b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/LICENSE new file mode 100644 index 00000000..2004a1f8 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/LICENSE @@ -0,0 +1,48 @@ +PYTHON SOFTWARE FOUNDATION LICENSE +---------------------------------- + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using this software ("Python") in source or binary form and +its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python +alone or in any derivative version, provided, however, that PSF's +License Agreement and PSF's notice of copyright, i.e., "Copyright (c) +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Python Software Foundation; +All Rights Reserved" are retained in Python alone or in any derivative +version prepared by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python. + +4. PSF is making Python available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. diff --git a/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/METADATA b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/METADATA new file mode 100644 index 00000000..28e6a628 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/METADATA @@ -0,0 +1,135 @@ +Metadata-Version: 2.1 +Name: fixedint +Version: 0.1.6 +Summary: simple fixed-width integers +Home-page: https://github.com/nneonneo/fixedint +Author: Robert Xiao +Author-email: robert.bo.xiao@gmail.com +License: PSF +Platform: UNKNOWN +Classifier: License :: OSI Approved :: Python Software Foundation License +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Topic :: Utilities + +===================================== +fixedint: simple fixed-width integers +===================================== + +This module provides fixed-size integer classes which retain their fixed nature across +arithmetic operations. It is geared towards users who need to emulate machine integers. + +It provides flexible classes for defining integers with a fixed number of bits, as well +as predefined classes for common machine integer sizes. These classes can be used as +drop-in replacements for int/long, and can be sliced to extract bitfields. + +Mutable versions of these integers are provided, enabling usages such as emulation of +machine registers. + + + +Basic Usage +=========== + +A collection of predefined fixed-width integers for widths 8, 16, 32 and 64 are available +in signed and unsigned varieties. Mutable and immutable versions of each type are provided. + +These are named as ``[Mutable][U]Int<N>``, e.g. ``UInt64`` or ``MutableInt8``. Use these +classes as you would ``int``; arithmetic operations involving these classes will preserve +fixed width. For example:: + + x = UInt32(0) + print(hex(~x)) # prints 0xffffffff + +Mutable instances can be modified in-place, preserving their type:: + + x = MutableUInt32(0) + y = x + x += 100 + print(y) # prints 100 + +To set a mutable integer without losing its type, use slicing:: + + x = MutableUInt32(0) + x[:] = -1 + print(hex(x)) # prints 0xffffffff + + +Arithmetic Operations +===================== + +``FixedInt`` instances support all arithmetic operators. For binary operators, both +operands are converted to plain Python ``int`` and then operated on. With a few +exceptions, the result will be cast back to a ``FixedInt`` large enough to hold either +operand, provided one of the operands was a ``FixedInt``. Note that the resulting +``FixedInt`` may not be large enough to hold the complete result, in which case the +result will be truncated. + +The exceptions are as follows: + +* ``divmod`` returns a tuple of plain ``int`` s +* true division returns a float +* ``**``, ``<<`` and ``>>`` will return a ``FixedInt`` if the left operand was a + ``FixedInt``, and plain ``int`` otherwise. + +Mutable instances additionally support in-place operations, which will modify the +value without altering its type. + + +Arithmetic operations between two integers of different sizes follow C integer promotion +rules when determining the type of the final result. These rules boil down to the +following: + +* If the operands are both signed, or both unsigned, the wider of the two operand types is chosen. +* Otherwise, if the unsigned operand is wider, the unsigned operand is chosen. +* Otherwise, the signed operand is chosen. + + + + +Slicing +======= + +``FixedInt`` instances support slicing. Slicing with a single integer produces a single +Boolean value representing the bit at that position. Slicing with a range produces a +``FixedInt`` containing the range of bits. Mutable instances additionally support slice +assignment. This makes e.g. manipulating a flag register straightforward, without needing +to use bitwise operations. + +All indexing operations treat the least-significant bit (LSB) as bit 0. Currently, only +contiguous bit sections can be obtained; for more flexibility consider using a module +such as `bitarray`. + +Getting a slice results in a ``FixedInt`` instance with exactly as many bits as the range. +This can be used to perform wraparound arithmetic on a bit field. + +Slices support two main syntaxes:: + + value[<start>:<end>] + value[<start>:<length>j] + +The latter syntax is more convenient when dealing with fixed-width fields. Both of the +slice arguments may be omitted, in which case they will default to the LSB and MSB of +the ``FixedInt`` respectively. + + + +Byte Conversion +=============== + +``FixedInt`` instances can be converted to and from raw byte representations by using the +``.to_bytes`` instance method and the ``.from_bytes`` classmethod. The usage of these +methods matches that of Python 3.4's ``int.to_bytes`` and ``int.from_bytes`` methods. + + + + + diff --git a/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/RECORD b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/RECORD new file mode 100644 index 00000000..10d45f64 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/RECORD @@ -0,0 +1,19 @@ +fixedint-0.1.6.dist-info/AUTHORS,sha256=DAksIxcS1SY3lu6_AxLflh_i0lh0fQBvGYJ56ebHwT8,78
+fixedint-0.1.6.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+fixedint-0.1.6.dist-info/LICENSE,sha256=hcprq4m_9xCuseB--rc8JZ7nxT1H9sIZQWdCJLqgOg4,2388
+fixedint-0.1.6.dist-info/METADATA,sha256=B3sbghFuw5YeIW_jPO6zRlVxsPLenJMQp899g2RnrFk,4822
+fixedint-0.1.6.dist-info/RECORD,,
+fixedint-0.1.6.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
+fixedint-0.1.6.dist-info/top_level.txt,sha256=3j0TE2C2A_UZDsAg9hPMYB5kYFBkFJefG4tK1w_LGhs,9
+fixedint/__init__.py,sha256=fGCV9IahJnJq3dHF2qGPNpSLfhIR9BRHQuK1DM4pQ0I,251
+fixedint/__pycache__/__init__.cpython-312.pyc,,
+fixedint/__pycache__/aliases.cpython-312.pyc,,
+fixedint/__pycache__/base.cpython-312.pyc,,
+fixedint/__pycache__/compat.cpython-312.pyc,,
+fixedint/__pycache__/test_fixedint.cpython-312.pyc,,
+fixedint/__pycache__/util.cpython-312.pyc,,
+fixedint/aliases.py,sha256=w1IAB8tyrmcK0BK_K0h5PAx5tZaclMmUcB4ks5lYrSc,319
+fixedint/base.py,sha256=mWLdNnjzhsQKwYLEPVl2bNwgen6iRv5NexeyWO4OFfQ,15139
+fixedint/compat.py,sha256=fvGTEt_ojR0igunHaDugRvtwgyKGe2i6KvwyF2TecLw,675
+fixedint/test_fixedint.py,sha256=Xh1kGOodFAvftlzRnWWKHJ_H2BLRvIccoMwKNx3qzzA,11380
+fixedint/util.py,sha256=hNuF0bYRE1QHXMYssJVa93N2X0f-Z21DQcI3Lno9znw,233
diff --git a/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/WHEEL b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/WHEEL new file mode 100644 index 00000000..b552003f --- /dev/null +++ b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.34.2) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/top_level.txt b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/top_level.txt new file mode 100644 index 00000000..32eb2ea8 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/fixedint-0.1.6.dist-info/top_level.txt @@ -0,0 +1 @@ +fixedint |