GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - microjs/bitarray: Pure JavaScript bit array/bitfield implementation

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
README.md
README.md
 
 
bitarray.js
bitarray.js
 
 
component.json
component.json
 
 
package.json
package.json
 
 
test.js
test.js
 
 

Repository files navigation

Build Status

BitArray

BitArray is a simple bit array/bit field library in pure JavaScript

BitArray is based on the Ruby library BitArray by Peter Cooper (https://github.com/peterc/bitarray).

Basic, pure JavaScript bit field.

Installation

Server:

$ npm install bitarray

Client:

$ component install microjs/bitarray

Examples

Create a bit array 1000 bits wide:

var ba = new BitArray(1000);

Setting and reading bits:

ba.set(100, 1);
ba.get(100); // => 1

ba.set(100, 0);
ba.get(100); // => 0

Create a BitArray where all the bits default to 1:

var ba = new BitArray(100, 1);
ba.get(50); // => 1

toString:

var ba = new BitArray(20);
[1,3,5,9,11,13,15].forEach(function(i){ ba.set(i, 1) });
ba.toString(); // => "01010100010101010000"

Notes

The total_set method is not ported for now.

There might be bugs, this is just a quick port. Non-sucky tests would be awesome. hinthint (The test file from the original repo https://github.com/peterc/bitarray/blob/master/test/test_bitarray.rb should be ported.)

License

MIT licensed. Copyight 2012 Thomas Fuchs, yada yada. Original library: Copyright 2007-2012 Peter Cooper, yada yada.

About

Pure JavaScript bit array/bitfield implementation

Resources

Readme
Activity
Custom properties

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.