GitXplorerGitXplorer
s

dynamic_bitset

public
10 stars
1 forks
1 issues

Commits

List of commits on branch master.
Unverified
65e589086e95dde12d53d37271bd1034477b2d57

Merge branch 'master' of github.com:syoyo/dynamic_bitset

ssyoyo committed 5 years ago
Unverified
f0bbd9fd1f6e4e26d58906eabae13e19e22a8acd

Add Azure pipeline badge.

ssyoyo committed 5 years ago
Unverified
c4fd0d35a93b4e5ea703270f126856dea410d056

Update azure-pipelines.yml for Azure Pipelines

ssyoyo committed 5 years ago
Unverified
cd7847dafc834c0078b37d720207ba045132dbd0

Set up CI with Azure Pipelines

ssyoyo committed 5 years ago
Unverified
96874a4154dcc175da337ccceb227269c16e4dbc

Add flip(), allset().

ssyoyo committed 5 years ago
Unverified
e45942774dd4ef3981f5e083a5258aed6eac25ea

Add more features.

ssyoyo committed 5 years ago

README

The README file for this repository.

Simple dynamic_bitset implementation in C++11

Build Status

dynamic_bitset is implemented as a template class, so you can just include the header file to use it. dynamic_bitset does not depend any library except for STL.

Requirements

  • C++11 compiler

Usage

#include "dynamic_bitset.hh"

// init with 13 bits. fill bitfield with value `42`
dynamic_bitset db(13, 42);

// init with 0bits
dynamic_bitset db;

// resize to 12 bits
db.resize(12);

// resize does not initialize extended memory region.
// Use `reset()` to clear all bitfields.
db.reset();

// set 3rd bit true
db.set(3);

// get 5th bit state
std::cout << db[5] << "\n";

// print bitfield
std::cout << db.to_string() << "\n";

// set all bits with true or false
db.setall(true);

Note

dynamic_bitset has similar functions defined in std::bitset and std::vector. dynamic_bitset is not compatible with boost::dynamic_bitset

TODO

  • [ ] Implement more features.
  • [ ] Validate endianness.
  • [ ] Write more tests.

Similar projects

License

dynamic_bitset is licensed under MIT license.

Thrid party license

  • acutest : For unit test. MIT license.