Skip to main content

No project description provided

Project description

two_comp

A library for converting numbers to twos complement values

Example usage

>>> import two_comp
>>> two_comp.twos_8(0xff)
-1
>>> two_comp.twos_8(0xef)
-17
>>> two_comp.twos_16(0xeeee)
-4370
>>> two_comp.twos_16(0xabcd)
-21555
>>> two_comp.twos_32(0xabcdabcd)
-1412584499
>>> two_comp.twos_64(0xabcdabcdabcdabcd)
-6067004223159161907
>>> two_comp.twos_64(0xabcd)
43981
>>> two_comp.twos_8(0xf)
15

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

two_comp-0.0.1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

two_comp-0.0.1-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page