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 hashes)
Built Distribution
Close
Hashes for PyJsBitwise-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17ce927611348d2499bb26ccbddd2bb47b683fd9e178e02839b5cc8bddd62ffc |
|
MD5 | 5df5bb47c4cf35be12691c03dc9970e4 |
|
BLAKE2b-256 | 8e4dbf0830d48a4a971adaa6214f601b8ddc31d2d9d45ac777705504602fc571 |