bitrepl
A REPL for bitwise and arithmetic operations. See results in hex, binary, and decimal (signed/unsigned) simultaneously.
Built for C systems programming courses.
Installation
pip install bitrepl
Usage
bitrepl
[32-bit] > 0xFF & 0x0F
$0:
Hex: 0x0000000F
Binary: 0000 0000 0000 0000 0000 0000 0000 1111
Unsigned: 15
Signed: 15
[32-bit] > ~0
$1:
Hex: 0xFFFFFFFF
Binary: 1111 1111 1111 1111 1111 1111 1111 1111
Unsigned: 4294967295
Signed: -1
Features
- Multi-format output: Every result shows hex, binary, unsigned, and signed representations
- C-style operators:
&|^~<<>>+-*/% - Number formats: Decimal (
255), hex (0xFF), binary (0b1111), octal (0o17) - Configurable bit width: 8, 16, 32, or 64 bits
- Result comparison: Compare multiple results side-by-side
- Variables: Store and reuse values
Commands
| Command | Description |
|---|---|
:width N |
Set bit width (8, 16, 32, 64) |
:cmp |
Compare last 2 results side-by-side |
:cmp N |
Compare last N results |
:vars |
Show stored variables |
:clear |
Clear result history |
:help |
Show help |
:quit |
Exit |
Variables
Reference previous results with $0, $1, etc:
[32-bit] > 0xFF
$0: ...
[32-bit] > $0 << 8
$1: ...
Store named variables:
[32-bit] > $mask = 0xFF
[32-bit] > 0xABCD & $mask
Comparison
Compare signed vs unsigned interpretation of the same bit pattern:
[8-bit] > 127
[8-bit] > 128
[8-bit] > :cmp
======================================================
COMPARISON:
------------------------------------------------------
127 128
------------------------------------------------------
Hex: 0x7F 0x80
Binary: 0111 1111 1000 0000
Unsigned: 127 128
Signed: 127 -128
======================================================
License
MIT
Metadata
Release files for bitrepl 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bitrepl-0.1.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bitrepl-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.7 kB
Release files / bitrepl-0.1.0.tar.gz
| Download URL | bitrepl-0.1.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5805ac4e0fccdacecc045aa492511c376baaaf3b2fc3f42ed78aebba34288f4a
|
|
BLAKE2b-256 checksum How to use checksums |
667c74f462b645a0d784f5be7e7e70c03d63f95f560c8616c438884077a6a487
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / bitrepl-0.1.0-py3-none-any.whl
| Download URL | bitrepl-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a96e73f22f320c89975bd36d6a553008eac01724645f9bcc2271d13d28afdfe1
|
|
BLAKE2b-256 checksum How to use checksums |
ab03ac02117644649ac5677ebf9fe5ca88acb695e6b704ecc7e3ff0e97a7691e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|