# PyJsShift
JavaScript-flavored bitwise operations.
# Usage
Import Module:
```python
from pyjsbitwise import *
```
Cast int or float to 32-bit signed value:
```python
i32cast(-2**31) # 2147483648
i32cast(2**53 / 3) # -1431655766
```
Bitwise not, and, or, xor like JavaScript's ~, &, |, ^:
```python
bwnot(float("NaN")) # -1
bwand(2**32-1, 2**32-1) # -1
bwor(2**31, 2**53) # -2147483648
bwxor(2**31, 2**31-1) # -1
```
Shift left, right and unsigned right like JavaScript's <<, >>, >>>:
```python
lshift(1, 32) # 1
rshift(-2, -31) # -1
urshift(-1, 0) # 4294967295
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Pairman/PyJsBitwise",
"name": "PyJsBitwise",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.0",
"maintainer_email": null,
"keywords": "javascript, js, bitwise, shift",
"author": "Pairman",
"author_email": "pairmanxlr@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/86/8c/6cce6be8e27a4f1aa0d29b3222c8dba24004e8e036794aaa4583c405350b/pyjsbitwise-1.0.2.tar.gz",
"platform": null,
"description": "# PyJsShift\nJavaScript-flavored bitwise operations.\n\n# Usage\nImport Module:\n```python\nfrom pyjsbitwise import *\n```\n\nCast int or float to 32-bit signed value:\n```python\ni32cast(-2**31) # 2147483648\ni32cast(2**53 / 3) # -1431655766\n```\n\nBitwise not, and, or, xor like JavaScript's ~, &, |, ^:\n```python\nbwnot(float(\"NaN\")) # -1\nbwand(2**32-1, 2**32-1) # -1\nbwor(2**31, 2**53) # -2147483648\nbwxor(2**31, 2**31-1) # -1\n```\n\nShift left, right and unsigned right like JavaScript's <<, >>, >>>:\n```python\nlshift(1, 32) # 1\nrshift(-2, -31) # -1\nurshift(-1, 0) # 4294967295\n```\n",
"bugtrack_url": null,
"license": "GNU General Public License v3 (GPLv3)",
"summary": "JavaScript-flavored bitwise operations.",
"version": "1.0.2",
"project_urls": {
"Changelog": "https://github.com/Pairman/PyJsBitwise/blob/main/CHANGELOG.md",
"Homepage": "https://github.com/Pairman/PyJsBitwise"
},
"split_keywords": [
"javascript",
" js",
" bitwise",
" shift"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8e4dbf0830d48a4a971adaa6214f601b8ddc31d2d9d45ac777705504602fc571",
"md5": "5df5bb47c4cf35be12691c03dc9970e4",
"sha256": "17ce927611348d2499bb26ccbddd2bb47b683fd9e178e02839b5cc8bddd62ffc"
},
"downloads": -1,
"filename": "PyJsBitwise-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5df5bb47c4cf35be12691c03dc9970e4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 14561,
"upload_time": "2024-04-24T05:22:08",
"upload_time_iso_8601": "2024-04-24T05:22:08.252619Z",
"url": "https://files.pythonhosted.org/packages/8e/4d/bf0830d48a4a971adaa6214f601b8ddc31d2d9d45ac777705504602fc571/PyJsBitwise-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "868c6cce6be8e27a4f1aa0d29b3222c8dba24004e8e036794aaa4583c405350b",
"md5": "6d85e1a97459cbc4f5a8d67b17cd2d8e",
"sha256": "b13ec20623c91b5a194b4b4f97d9a1a7089aa85595fbba7379eb5d1808448ba3"
},
"downloads": -1,
"filename": "pyjsbitwise-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "6d85e1a97459cbc4f5a8d67b17cd2d8e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0",
"size": 14506,
"upload_time": "2024-04-24T05:22:09",
"upload_time_iso_8601": "2024-04-24T05:22:09.390955Z",
"url": "https://files.pythonhosted.org/packages/86/8c/6cce6be8e27a4f1aa0d29b3222c8dba24004e8e036794aaa4583c405350b/pyjsbitwise-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-24 05:22:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Pairman",
"github_project": "PyJsBitwise",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyjsbitwise"
}