JavaScript-flavored bitwise operations.
Project description
PyJsShift
JavaScript-flavored bitwise operations.
Usage
Import Module:
from pyjsbitwise import *
Cast int or float to 32-bit signed value:
i32cast(-2**31) # 2147483648
i32cast(2**53 / 3) # -1431655766
Bitwise not, and, or, xor like JavaScript's ~, &, |, ^:
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 <<, >>, >>>:
lshift(1, 32) # 1
rshift(-2, -31) # -1
urshift(-1, 0) # 4294967295
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
pyjsbitwise-1.0.2.tar.gz
(14.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyjsbitwise-1.0.2.tar.gz.
File metadata
- Download URL: pyjsbitwise-1.0.2.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b13ec20623c91b5a194b4b4f97d9a1a7089aa85595fbba7379eb5d1808448ba3
|
|
| MD5 |
6d85e1a97459cbc4f5a8d67b17cd2d8e
|
|
| BLAKE2b-256 |
868c6cce6be8e27a4f1aa0d29b3222c8dba24004e8e036794aaa4583c405350b
|
File details
Details for the file PyJsBitwise-1.0.2-py3-none-any.whl.
File metadata
- Download URL: PyJsBitwise-1.0.2-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17ce927611348d2499bb26ccbddd2bb47b683fd9e178e02839b5cc8bddd62ffc
|
|
| MD5 |
5df5bb47c4cf35be12691c03dc9970e4
|
|
| BLAKE2b-256 |
8e4dbf0830d48a4a971adaa6214f601b8ddc31d2d9d45ac777705504602fc571
|