drinksong / bitwise64

Bitwise operation with 64bit integers in Javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bitwise64

npm version dependencies Build Status

Emurates 64-bit bitwise operation.

(Due to ECMAScript laungauge specification 53bit~ might not work well)

Note

There are BigInt proposal on stage-3. When it would be merged to main stream and major browsers implement it, we could operate 64-bit bitwise natively and you should use it instead of this library.

Install

npm install --save bitwise64

Example

var b64 = require('bitwise64');

console.log(b64.and(0xFFFFFFFFFFFF0, 0xFFFFFFFFFFFFF) === 0xFFFFFFFFFFFF0);

console.log(b64.or(0xFFFFFFFFFFFF0, 0xFFFFFFFFFFFFF) === 0xFFFFFFFFFFFFF);

console.log(b64.xor(0xFFFFFFFFFFFF0, 0xFFFFFFFFFFFFF) === 0xF);

console.log(b64.not(0x0FFFFFFFFF0) === 0xFFFFFF000000000F);

About

Bitwise operation with 64bit integers in Javascript

License:MIT License


Languages

Language:JavaScript 100.0%