hexintcalc


Namehexintcalc JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/hexintcalc
SummarySome functions to do mathematical operations on int/hex (automatic conversion of input dtypes - returns hex)
upload_time2023-02-07 23:51:17
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords hex calculate int convert
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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:



```python

"0x00000000`00000003"

"0x00000003"

"00000000`00000003"

"00000003"

"3"

"0x3"

3

3.0 (float will be converted to int)

```





```python

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'



```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/hexintcalc",
    "name": "hexintcalc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "hex,calculate,int,convert",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1f/73/81d964adda95bbfd246dc1b6abfa978756baf48d6d4b5afacba0c33a0cc0/hexintcalc-0.10.tar.gz",
    "platform": null,
    "description": "\n# Some functions to do mathematical operations on int/hex (automatic conversion of input dtypes - returns hex)\n\n\n\n### Input formats: \n\nHere are some variations you can pass to the functions:\n\n\n\n```python\n\n\"0x00000000`00000003\"\n\n\"0x00000003\"\n\n\"00000000`00000003\"\n\n\"00000003\"\n\n\"3\"\n\n\"0x3\"\n\n3\n\n3.0 (float will be converted to int)\n\n```\n\n\n\n\n\n```python\n\nfrom hexintcalc import (\n\n    hadd,\n\n    hbitwiseand,\n\n    hdivide,\n\n    heq,\n\n    hge,\n\n    hgt,\n\n    hexcalc,\n\n    hle,\n\n    hlshift,\n\n    hlt,\n\n    hmod,\n\n    hmul,\n\n    hne,\n\n    number_to_hex,\n\n    number_to_int,\n\n    hor_,\n\n    hpow,\n\n    hrshift,\n\n    hsub,\n\n    hxor,\n\n)\n\nn1=hadd(n1=50,n2='0xf',zfill=0, backtick=True, add0x=True)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hdivide(n1=50,n2='0xf',zfill=0, backtick=True, add0x=True)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hbitwiseand(n1=50,n2='0xf',zfill=8, backtick=False, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hxor(n1=50,n2=100,zfill=0, backtick=False, add0x=True)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hor_(n1=50,n2='0xf',zfill=0, backtick=True, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hpow(n1=50,n2='a',zfill=0, backtick=False, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hlshift(n1=50,n2='0xf',zfill=0, backtick=True, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hmod(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hmul(n1=50,n2='0xf',zfill=0, backtick=False, add0x=True)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hrshift(n1=50,n2='0xf',zfill=0, backtick=True, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hsub(n1=50,n2='0xf',zfill=0, backtick=True, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hlt(n1=50,n2='0xf',zfill=0, backtick=False, add0x=True)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hle(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=heq(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hne(n1=50,n2='0xf',zfill=0, backtick=False, add0x=True)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hge(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\nn1=hgt(n1=50,n2='0xf',zfill=0, backtick=False, add0x=False)\n\nprint(n1, int(n1.replace(\"`\", \"\"), base=16))\n\n\n\n\n\n0x00000000`00000041 65\n\n0x00000000`00000003 3\n\n00000002 2\n\n0x56 86\n\n00000000`0000003f 63\n\n15af1d78b58c400 97656250000000000\n\n00000000`00190000 1638400\n\n5 5\n\n0x2ee 750\n\n00000000`00000000 0\n\n00000000`00000023 35\n\n0x0 0\n\n0 0\n\n0 0\n\n0x1 1\n\n1 1\n\n1 1\n\n\n\n\n\nnumber_to_int('ff')\n\nOut[9]: 255\n\n\n\nnumber_to_hex(512)\n\nOut[7]: '0x200'\n\n\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Some functions to do mathematical operations on int/hex (automatic conversion of input dtypes - returns hex)",
    "version": "0.10",
    "split_keywords": [
        "hex",
        "calculate",
        "int",
        "convert"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3e8631c05a563b464d8d749a512e8afc91670b2a482f483f554f19d66974d3f7",
                "md5": "7a216a916e3d4b6d02010b42098b1a2b",
                "sha256": "398e839da1018a52bbe258edb4e2109e04cc4e4a1d49f149da81fb7a56bc0cb0"
            },
            "downloads": -1,
            "filename": "hexintcalc-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7a216a916e3d4b6d02010b42098b1a2b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5501,
            "upload_time": "2023-02-07T23:51:15",
            "upload_time_iso_8601": "2023-02-07T23:51:15.774922Z",
            "url": "https://files.pythonhosted.org/packages/3e/86/31c05a563b464d8d749a512e8afc91670b2a482f483f554f19d66974d3f7/hexintcalc-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f7381d964adda95bbfd246dc1b6abfa978756baf48d6d4b5afacba0c33a0cc0",
                "md5": "7a1315879bf723811efbb4365fb46204",
                "sha256": "a319760bb9c654692202c552aa3a76bebbb1eba55f8aee6194870a5ad135bdc2"
            },
            "downloads": -1,
            "filename": "hexintcalc-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "7a1315879bf723811efbb4365fb46204",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4814,
            "upload_time": "2023-02-07T23:51:17",
            "upload_time_iso_8601": "2023-02-07T23:51:17.616080Z",
            "url": "https://files.pythonhosted.org/packages/1f/73/81d964adda95bbfd246dc1b6abfa978756baf48d6d4b5afacba0c33a0cc0/hexintcalc-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-07 23:51:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "hexintcalc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "hexintcalc"
}
        
Elapsed time: 0.09683s