8000 GitHub - goldsborough/bitset: A pure C Bitset implementation.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

goldsborough/bitset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bitset

GitHub license

bitset is a feature-complete, generic and customizable dynamic bitset implementation in pure C. It adapts my vector data structure.

Usage

#include "bitset.h"

int main(int argc, const char* argv[]) {
	BitSet bitset = BITSET_INITIALIZER;
	bitset_setup(&bitset, 100);

	bitset_set(&bitset, 10);

	if (bitset_test(&bitset, 10)) {
		bitset_toggle(&bitset, 10);
	} else {
		bitset_assign(&bitset, 10, true);
	}

	if (bitset_any(&bitset)) {
		bitset_clear(&bitset);
	} else {
		bitset_push(&bitset, true);
		printf("%d bit(s) are set\n", bitset_count(&bitset));
	}

	bitset_destroy(&bitset);

	uint64_t value = 0x123456789ABCDEF0;
	bitset = bitset_from_value(value);

	printf("The MSB is: %d\n", bitset_msb(&bitset));

	bitset_destroy(&bitset);
}

LICENSE

This project is released under the MIT License. For more information, see the LICENSE file.

Authors

Peter Goldsborough + cat ❤️

About

A pure C Bitset implementation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0