Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Update README.md
- Loading branch information
Showing
1 changed file
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,6 +1,26 @@ | |||
dynamicbitset | dynamicbitset | ||
============= | ============= | ||
|
|
||
Simple C++ dynamic bit array. It is like ```std::bitset``` but its size can be dynamically set. | Simple C++ dynamic bit array. It is like ```std::bitset``` but its size can be dynamically set. The bits are stored from left-to-right order as if in an array, where the leftmost bit is the ```0```th and the rightmost bit is the ```(n-1)```th bit. | ||
|
|
||
See ds.dynamicbitset.test.h for usage. | Under the hood, bits are stored in a byte array, and the rightmost ```8-(n%8)``` bits in the rightmost byte remain unused. | ||
|
|||
The code is compiled under both ```MSVC``` and ```GCC```, and tested using Google C++ testing framework (http://code.google.com/p/googletest/). | |||
|
|||
See the ```ds.dynamicbitset.test.h``` file for usage. | |||
|
|||
Supported Operations | |||
==================== | |||
* You can create a bit-array whose size can be set dynamically set. This is in contrast with ```std::bitset``` for which the size needs to be set in compile-time through template argument. | |||
* You can create of empty (zero-size) bit-array which can be later initialized from any existing bit-array. | |||
* You can get/set any bit. You can also set bits from an integer, where the higher-order bits of the supplied integer are copied to the bit-array. | |||
* You can perform any/all/flip operations on the bit-array. | |||
* You can perform standard bit-by-bit comparison operations between two bit-arrays. Supported comparisons are ```<, <=, >, >=, !=, ==```. | |||
* You can extract a particular byte from the bit array. | |||
* You can convert the bit-array into an ```std::string```, a ```const unsigned char*```, or even an ```int```. The last conversion is possible if the size of the bit-array is less than the number of bits in an ```int```. | |||
* You can print a bit-array through an output stream like ```cout << myBitArray```. | |||
|
|||
|
|||
To Do | |||
===== | |||
* Standard bitwise operations between two ```DynamicBitset``` objects. |