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.1.tar.gz
(14.5 kB
view hashes)
Built Distribution
Close
Hashes for PyJsBitwise-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30e9239c028e7bfa14cb3dfec824257bdbb4effb6eee7fd7a4aa9911aec224c6 |
|
MD5 | f6367cd9e99152c5f9ad223bf5b0dce7 |
|
BLAKE2b-256 | 8130570aa34eb0177e5ffca7d00e55f93686667188c7d827293e02f78fa58c32 |