https://github.com/sha0coder/unsigned
python module for doing c signed and unsigned operations
https://github.com/sha0coder/unsigned
Last synced: 9 months ago
JSON representation
python module for doing c signed and unsigned operations
- Host: GitHub
- URL: https://github.com/sha0coder/unsigned
- Owner: sha0coder
- Created: 2023-12-01T21:20:39.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-05T15:19:52.000Z (over 1 year ago)
- Last Synced: 2025-02-06T11:46:41.240Z (11 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Documentation
```
from unsigned import Unsigned32
a = Unsigned32(-1)
b = Unsigned32(0xffffffff)
assert a == b
a.sub(b)
a.add(b)
a.ror(2)
a.rol(3)
a.or_op(b)
a.not_op()
a.and_op(b)
a.neg()
a.xor(b)
a.shl(2)
a.shr(3)
assert a.hex() == '0x1fffffff'
assert a() == 0x1fffffff
```
```
from unsigned import Signed16
a = Signed16(-1)
b = Signed16(0xffff)
assert a == b
a.sub(b)
a.add(b)
a.ror(2)
a.rol(3)
a.or_op(b)
a.not_op()
a.and_op(b)
a.neg()
a.xor(b)
a.shl(2)
a.shr(3)
assert a.hex() == '-0x1'
```