Skip to main content

Some functions to do mathematical operations on int/hex (automatic conversion of input dtypes - returns hex)

Input formats:

Here are some variations you can pass to the functions:

"0x00000000`00000003"

"0x00000003"

"00000000`00000003"

"00000003"

"3"

"0x3"

3

3.0 (float will be converted to int)
from hexintcalc import (

    hadd,

    hbitwiseand,

    hdivide,

    heq,

    hge,

    hgt,

    hexcalc,

    hle,

    hlshift,

    hlt,

    hmod,

    hmul,

    hne,

    number_to_hex,

    number_to_int,

    hor_,

    hpow,

    hrshift,

    hsub,

    hxor,

)

n1=hadd(n1=50,n2='0xf',zfill=0, backtick=True, add0x=True)

print(n1, int(n1.replace("`", ""), base=16))

n1=hdivide(n1=50,n2='0xf',zfill=0, backtick=True, add0x=True)

print(n1, int(n1.replace("`", ""), base=16))

n1=hbitwiseand(n1=50,n2='0xf',zfill=8, backtick=False, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hxor(n1=50,n2=100,zfill=0, backtick=False, add0x=True)

print(n1, int(n1.replace("`", ""), base=16))

n1=hor_(n1=50,n2='0xf',zfill=0, backtick=True, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hpow(n1=50,n2='a',zfill=0, backtick=False, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hlshift(n1=50,n2='0xf',zfill=0, backtick=True, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hmod(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hmul(n1=50,n2='0xf',zfill=0, backtick=False, add0x=True)

print(n1, int(n1.replace("`", ""), base=16))

n1=hrshift(n1=50,n2='0xf',zfill=0, backtick=True, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hsub(n1=50,n2='0xf',zfill=0, backtick=True, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hlt(n1=50,n2='0xf',zfill=0, backtick=False, add0x=True)

print(n1, int(n1.replace("`", ""), base=16))

n1=hle(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=heq(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hne(n1=50,n2='0xf',zfill=0, backtick=False, add0x=True)

print(n1, int(n1.replace("`", ""), base=16))

n1=hge(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))

n1=hgt(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)

print(n1, int(n1.replace("`", ""), base=16))





0x00000000`00000041 65

0x00000000`00000003 3

00000002 2

0x56 86

00000000`0000003f 63

15af1d78b58c400 97656250000000000

00000000`00190000 1638400

5 5

0x2ee 750

00000000`00000000 0

00000000`00000023 35

0x0 0

0 0

0 0

0x1 1

1 1

1 1





number_to_int('ff')

Out[9]: 255



number_to_hex(512)

Out[7]: '0x200'

Metadata

Release files for hexintcalc 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hexintcalc 0.10
File Size Uploaded Provenance Actions
hexintcalc-0.10.tar.gz 4.8 kB Without provenance Details for hexintcalc-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hexintcalc 0.10
File Interpreter ABI Platform Actions
hexintcalc-0.10-py3-none-any.whl Python 3 none any Details for hexintcalc-0.10-py3-none-any.whl

Total release size: 10.3 kB

Release files / hexintcalc-0.10.tar.gz

Download URL hexintcalc-0.10.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a319760bb9c654692202c552aa3a76bebbb1eba55f8aee6194870a5ad135bdc2
BLAKE2b-256 checksum
How to use checksums
1f7381d964adda95bbfd246dc1b6abfa978756baf48d6d4b5afacba0c33a0cc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / hexintcalc-0.10-py3-none-any.whl

Download URL hexintcalc-0.10-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
398e839da1018a52bbe258edb4e2109e04cc4e4a1d49f149da81fb7a56bc0cb0
BLAKE2b-256 checksum
How to use checksums
3e8631c05a563b464d8d749a512e8afc91670b2a482f483f554f19d66974d3f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for hexintcalc 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page