--- id: fixedint version: "0.2.0" license: PSF license_treatment: permissive maintenance: dormant --- # fixedint — simple fixed-width integers License: permissive · Maintenance: dormant · Downloads: 4.4M/mo ## What it is and what it does fixedint provides Python classes that represent integers with a fixed number of bits, mimicking the behavior of machine integers in C or assembly. It includes predefined classes for common widths (8, 16, 32, 64 bits) in both signed and unsigned variants, plus mutable and immutable versions of each. Arithmetic operations on these integers automatically wrap and truncate to preserve the fixed width, so operations like bitwise NOT on a 32-bit unsigned integer produce the expected 0xffffffff rather than Python's arbitrary-precision result. The package supports slicing to extract and manipulate individual bits or bit ranges, making it useful for register emulation and bitfield manipulation. Mutable instances can be modified in-place while retaining their type, and both variants provide byte conversion methods compatible with Python 3.4+. It is designed as a drop-in replacement for int in contexts where fixed-width semantics are required. Use it for: - Emulate CPU registers or memory-mapped hardware with fixed bit widths and wraparound arithmetic. - Extract and manipulate individual bits or bit ranges from flag registers without manual bitwise operations. - Implement low-level algorithms that depend on C-style integer overflow and truncation behavior. - Convert between fixed-width binary representations and Python integers for protocol or file format handling. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides fixed-width integer classes that preserve their bit width across arithmetic operations, with both mutable and immutable variants for emulating machine integers. Yes, if you need fixed-width integer semantics for hardware emulation, low-level algorithms, or bitfield manipulation and can tolerate dormant maintenance. The package has no dependencies, installs easily, and carries no security vulnerabilities. However, do not use it if you require active bug fixes or Python version support beyond what was tested at the last release in 2022. ## Install pip install fixedint uv add fixedint poetry add fixedint ## Installing fixedint Before you install: Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2022-09-16 and last commit 2024-04-08, so expect no active bug fixes or feature updates. License in practice: Licensed under PSF (Python Software Foundation License), a permissive license with no significant restrictions on use or distribution. Quickstart: from fixedint import UInt32, MutableUInt32 x = UInt32(0) print(hex(~x)) # prints 0xffffffff y = MutableUInt32(0) y[:] = -1 print(hex(y)) # prints 0xffffffff Verify before relying: - Whether the package works reliably with Python 3.10+ given dormant maintenance status. - Performance characteristics for large-scale bitfield operations compared to alternatives. ## Package facts - License: PSF (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 4.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags fixed-width integers, machine integer emulation, bitfield manipulation, fixed-size int types, mutable integers, bit slicing, integer overflow behavior, bit-manipulation, hardware-emulation [View on SkillFed](https://skillfed.io/packages/fixedint) · [View on PyPI](https://pypi.org/project/fixedint/)