diff options
| author | Tyge Løvset <[email protected]> | 2022-12-31 09:41:24 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-12-31 09:41:24 +0100 |
| commit | 91e79fc60713c1f09e940a7ee83ff2f8aa4f9d69 (patch) | |
| tree | b2f1eb8fef010ec490efcf0fb420b218ad23a4dd /include/stc/cbits.h | |
| parent | 89de800ff2e0a8389359a8a7a2684edaae8ce742 (diff) | |
| download | STC-modified-91e79fc60713c1f09e940a7ee83ff2f8aa4f9d69.tar.gz STC-modified-91e79fc60713c1f09e940a7ee83ff2f8aa4f9d69.zip | |
Internally renamed ccommon.h macros to uppercase. Lowercase macros are still supported via include/stc/priv/lowcase.h.
Diffstat (limited to 'include/stc/cbits.h')
| -rw-r--r-- | include/stc/cbits.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/stc/cbits.h b/include/stc/cbits.h index 3c187e78..fde1d05f 100644 --- a/include/stc/cbits.h +++ b/include/stc/cbits.h @@ -27,13 +27,13 @@ Similar to boost::dynamic_bitset / std::bitset #include "cbits.h" int main() { - c_with (cbits bset = cbits_with_size(23, true), cbits_drop(&bset)) + c_WITH (cbits bset = cbits_with_size(23, true), cbits_drop(&bset)) { cbits_reset(&bset, 9); cbits_resize(&bset, 43, false); printf("%4zu: ", cbits_size(&bset)); - c_forrange (i, cbits_size(&bset)) + c_FORRANGE (i, cbits_size(&bset)) printf("%d", cbits_at(&bset, i)); puts(""); cbits_set(&bset, 28); @@ -43,7 +43,7 @@ int main() { cbits_set_value(&bset, 99, false); printf("%4zu: ", cbits_size(&bset)); - c_forrange (i, cbits_size(&bset)) + c_FORRANGE (i, cbits_size(&bset)) printf("%d", cbits_at(&bset, i)); puts(""); } @@ -125,7 +125,7 @@ struct { uint64_t *data64; size_t _size; } typedef i_type; STC_INLINE cbits cbits_init(void) { return c_INIT(cbits){NULL}; } STC_INLINE void cbits_create(cbits* self) { self->data64 = NULL; self->_size = 0; } -STC_INLINE void cbits_drop(cbits* self) { c_free(self->data64); } +STC_INLINE void cbits_drop(cbits* self) { c_FREE(self->data64); } STC_INLINE size_t cbits_size(const cbits* self) { return self->_size; } STC_INLINE cbits* cbits_take(cbits* self, cbits other) { @@ -138,7 +138,7 @@ STC_INLINE cbits* cbits_take(cbits* self, cbits other) { STC_INLINE cbits cbits_clone(cbits other) { const size_t bytes = _cbits_bytes(other._size); - cbits set = {(uint64_t *)memcpy(c_malloc(bytes), other.data64, bytes), other._size}; + cbits set = {(uint64_t *)memcpy(c_MALLOC(bytes), other.data64, bytes), other._size}; return set; } @@ -153,7 +153,7 @@ STC_INLINE cbits* cbits_copy(cbits* self, const cbits* other) { STC_INLINE void cbits_resize(cbits* self, const size_t size, const bool value) { const size_t new_n = _cbits_words(size), osize = self->_size, old_n = _cbits_words(osize); - self->data64 = (uint64_t *)c_realloc(self->data64, new_n*8); + self->data64 = (uint64_t *)c_REALLOC(self->data64, new_n*8); self->_size = size; if (new_n >= old_n) { memset(self->data64 + old_n, -(int)value, (new_n - old_n)*8); @@ -175,13 +175,13 @@ STC_INLINE cbits cbits_move(cbits* self) { } STC_INLINE cbits cbits_with_size(const size_t size, const bool value) { - cbits set = {(uint64_t *)c_malloc(_cbits_bytes(size)), size}; + cbits set = {(uint64_t *)c_MALLOC(_cbits_bytes(size)), size}; cbits_set_all(&set, value); return set; } STC_INLINE cbits cbits_with_pattern(const size_t size, const uint64_t pattern) { - cbits set = {(uint64_t *)c_malloc(_cbits_bytes(size)), size}; + cbits set = {(uint64_t *)c_MALLOC(_cbits_bytes(size)), size}; cbits_set_pattern(&set, pattern); return set; } |
