Some functions to do mathematical operations on int/hex (automatic conversion of input dtypes - returns hex)
Project description
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'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hexintcalc-0.10.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file hexintcalc-0.10.tar.gz
.
File metadata
- Download URL: hexintcalc-0.10.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a319760bb9c654692202c552aa3a76bebbb1eba55f8aee6194870a5ad135bdc2 |
|
MD5 | 7a1315879bf723811efbb4365fb46204 |
|
BLAKE2b-256 | 1f7381d964adda95bbfd246dc1b6abfa978756baf48d6d4b5afacba0c33a0cc0 |
File details
Details for the file hexintcalc-0.10-py3-none-any.whl
.
File metadata
- Download URL: hexintcalc-0.10-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 398e839da1018a52bbe258edb4e2109e04cc4e4a1d49f149da81fb7a56bc0cb0 |
|
MD5 | 7a216a916e3d4b6d02010b42098b1a2b |
|
BLAKE2b-256 | 3e8631c05a563b464d8d749a512e8afc91670b2a482f483f554f19d66974d3f7 |