https://github.com/narasimha1997/bit_vector
A header-only bit vector library for C . This can be used for implementing dynamic bit-vectors for building Bloom-Filters and Hyper-Logs .
https://github.com/narasimha1997/bit_vector
bloom-filter c cplusplus datastructures hashtable hyperloglog
Last synced: 29 days ago
JSON representation
A header-only bit vector library for C . This can be used for implementing dynamic bit-vectors for building Bloom-Filters and Hyper-Logs .
- Host: GitHub
- URL: https://github.com/narasimha1997/bit_vector
- Owner: Narasimha1997
- License: gpl-3.0
- Created: 2019-08-30T17:56:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-01T14:40:17.000Z (over 6 years ago)
- Last Synced: 2025-04-12T04:40:25.246Z (12 months ago)
- Topics: bloom-filter, c, cplusplus, datastructures, hashtable, hyperloglog
- Language: C
- Size: 20.5 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bit_vector
A header-only bit vector library for C . This can be used for implementing dynamic bit-vectors for building Bloom-Filters and Hyper-Logs .
This repository provides header files for creating and using a datastructure called bit-vector. Bit Vector is char array with operations implemented
at bit level.
### Usage :
Just import `bit_vector.h` , you are ready to go.
Example program demonstrating usage of `bit_vector.h` routines :
```C
#include
#include
int main(int argc, char const *argv[])
{
bit_group_t * bit_vector = create_bit_vector(64);
set_bit(bit_vector, 15);
set_bit(bit_vector, 10);
set_bit(bit_vector, 0);
set_bit(bit_vector, 20);
set_bit(bit_vector, 33);
set_bit(bit_vector, 63);
printf("-------Tests---------\n");
int count = get_n_bits_set(bit_vector, 64);
printf("Count test : %d\n", count);
printf("is set test : %d\n", check_is_set(bit_vector, 32));
printf("\nReset test\n");
reset_bit(bit_vector, 20);
printf("Bit at position 20 : %d\n", check_is_set(bit_vector, 20));
return 0;
}
```
You can also use routines in `bit.h` to implement your own bit vector functionalities.