happy-san / bit_array

Bit array implementation in Dart

Home Page:https://pub.dartlang.org/packages/bit_array

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bit array implementation in Dart

A bit array (also known as BitMap, BitSet, BitString, or BitVector) is an array data structure that compactly stores bits.

Usage

A simple usage example:

import 'package:bit_array/bit_array.dart';

main() {
  final array = new FixedBitArray(1024);
  array[12] = true;
  array.setBit(123);
  array.invertBit(200);
  array.clearBit(12);
  print(array.asIntIterable().toList()); // prints [123, 200]

  final other = new FixedBitArray(1024);
  other[123] = true;

  final and = array & other;
  print(and.asIntIterable().toList()); // prints [123]
}

About

Bit array implementation in Dart

https://pub.dartlang.org/packages/bit_array

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dart 100.0%