bitwisejs and word state manipulations

Pierre Fromager 97e1bfe78b feat : Bits extends BitsConstants 3 years ago
src 97e1bfe78b feat : Bits extends BitsConstants 3 years ago
tests dab06bf4bd feat : Bits extends BitsConstants 3 years ago
.eslintrc.json b30810e1b3 ref : setBit use some static constants 3 years ago
.gitignore 66280de9f0 clean : remove nyc output 3 years ago
README.md fc3c18ea36 fix : fix setBit on number greater than 32bits 3 years ago
package-lock.json b6d38f904d test : uint64toArrayOfUint8 use a data providers 3 years ago
package.json b6d38f904d test : uint64toArrayOfUint8 use a data providers 3 years ago

README.md

BitwiseJs

Is a CommonJs Es6 module to manipulate bits.

Abstract

Because numeric values are default coded as floating-point in 64-bit format IEEE-754 \Ö/, unexpected results can popup while bitwise operations.
In order to operate, Number(s), I mean the integer part is stored in a 52 bits matissa.
Max integer value is 2^53 and min -2^53, read stackoverflow.
To raise this kind of caveat, ArrayBuffer usage is highly recommended to isolate bytes state before processing.
This may be used to build state machine or other stuffs...bitwise based.

Requirements

Prod

  • Nodejs.

Dev

  • Mocha module.
  • Bash bc command.

Dependencies

  • None

Setup

npm i

Test

Js

To run Mocha test suite :

npm test

Integration

Sample to integrate beta release

npm i https://gogs.pier-infor.fr/pf.pier-infor.fr/bitwisejs/archive/1.0.0.tar.gz --save

Bash

Replacing 'numberValue' by the value of the number. Get a bin view :

echo "obase=2;'numberValue'" | bc

Get an hex view :

echo "obase=16;'numberValue'" | bc

Linter

npm run lint

Todo

  • Improve test coverage (wip).
  • Describe module integration (forthcoming).
  • Improve tests on float values (forthcoming).