diff options
| author | Tyge Løvset <[email protected]> | 2022-05-24 21:12:56 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-05-24 21:12:56 +0200 |
| commit | ebc7316ac3859bc5e2f01c85bee86d6adea45898 (patch) | |
| tree | fb653c49e223cca40aea3fc2d734cd69b608b46d /docs/cbits_api.md | |
| parent | 966100106830f990bc3e1b40a5b5c39b64d5e9b0 (diff) | |
| download | STC-modified-ebc7316ac3859bc5e2f01c85bee86d6adea45898.tar.gz STC-modified-ebc7316ac3859bc5e2f01c85bee86d6adea45898.zip | |
API change: cbits now uses container pointers args in all member functions, except clone() ... for now. All containers may get same treatment! which will be a rather big API change. This was needed after testing fixed size cbits performance with pass-by-value: was very slow for large bitsets: now faster than std::bitset<>. Also reverted previous cbits_set_value(): much faster because it is branchless.
Diffstat (limited to 'docs/cbits_api.md')
| -rw-r--r-- | docs/cbits_api.md | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/docs/cbits_api.md b/docs/cbits_api.md index b9d54737..613c2d8c 100644 --- a/docs/cbits_api.md +++ b/docs/cbits_api.md @@ -21,38 +21,38 @@ All cbits definitions and prototypes are available by including a single header ```c cbits cbits_init(void); cbits cbits_from(const char* str); -cbits cbits_with_size(size_t size, bool value); // size must be <= N if N is defined +cbits cbits_with_size(size_t size, bool value); // size must be <= N if N is defined cbits cbits_with_pattern(size_t size, uint64_t pattern); cbits cbits_clone(cbits other); void cbits_clear(cbits* self); -cbits* cbits_copy(cbits* self, cbits other); -void cbits_resize(cbits* self, size_t size, bool value); // only if i_len is not defined +cbits* cbits_copy(cbits* self, const cbits* other); +void cbits_resize(cbits* self, size_t size, bool value); // only if i_len is not defined void cbits_drop(cbits* self); -cbits* cbits_take(cbits* self, cbits other); // give other to self -cbits cbits_move(cbits* self); // transfer self to caller - -size_t cbits_size(cbits set); -size_t cbits_count(cbits set); // count number of bits set - -bool cbits_test(cbits set, size_t i); -bool cbits_at(cbits set, size_t i); // same as cbits_test() -bool cbits_subset_of(cbits set, cbits other); // is set a subset of other? -bool cbits_disjoint(cbits set, cbits other); // no common bits -char* cbits_to_str(cbits set, char* str, size_t start, intptr_t stop); - -void cbits_set(cbits *self, size_t i); -void cbits_reset(cbits *self, size_t i); -void cbits_set_value(cbits *self, size_t i, bool value); -void cbits_set_all(cbits *self, bool value); -void cbits_set_pattern(cbits *self, uint64_t pattern); -void cbits_flip_all(cbits *self); -void cbits_flip(cbits *self, size_t i); - -void cbits_intersect(cbits *self, cbits other); -void cbits_union(cbits *self, cbits other); -void cbits_xor(cbits *self, cbits other); // set of disjoint bits +cbits* cbits_take(cbits* self, const cbits* other); // give other to self +cbits cbits_move(cbits* self); // transfer self to caller + +size_t cbits_size(const cbits* self); +size_t cbits_count(const cbits* self); // count number of bits set + +bool cbits_test(const cbits* self, size_t i); +bool cbits_at(const cbits* self, size_t i); // same as cbits_test() +bool cbits_subset_of(const cbits* self, const cbits* other); // is set a subset of other? +bool cbits_disjoint(const cbits* self, const cbits* other); // no common bits +char* cbits_to_str(const cbits* self, char* str, size_t start, intptr_t stop); + +void cbits_set(cbits* self, size_t i); +void cbits_reset(cbits* self, size_t i); +void cbits_set_value(cbits* self, size_t i, bool value); +void cbits_set_all(cbits* self, bool value); +void cbits_set_pattern(cbits* self, uint64_t pattern); +void cbits_flip_all(cbits* self); +void cbits_flip(cbits* self, size_t i); + +void cbits_intersect(cbits* self, const cbits* other); +void cbits_union(cbits* self, const cbits* other); +void cbits_xor(cbits* self, const cbits* other); // set of disjoint bits ``` ## Types |
