cbitset icon indicating copy to clipboard operation
cbitset copied to clipboard

A simple bitset library in C

cbitset

Build Status Ubuntu 20.04 CI (GCC 9) Ubuntu 18.04 CI (GCC 7) MSYS2-CI Visual Studio-CI

Simple bitset library in C. It includes fast functions to compute cardinalities, unions, intersections...

  • It is tiny: it is made of three files (two header files and one source file).
  • It is tested.
  • It is fast.
  • It is straight C.

Usage in C:

bitset_t * b = bitset_create();
bitset_set(b,10);
bitset_get(b,10);// returns true
bitset_free(b); // frees memory

CMake

mkdir build
cd build
cmake ..
cmake --build . --config Release  
ctest .

The cmake build also supports installation. The header files will be installed in a distinct subdirectory (cbitset).

Old-school Makefiles

To run tests:

make
./unit

Prerequisites

C11-compatible compiler.

Visual Studio now supports the C11 and C17 standards.