diff options
| author | Tyge Løvset <[email protected]> | 2023-04-27 12:41:24 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-04-27 12:41:24 +0200 |
| commit | ba3f2284731e50100d249cf1d825b8d24efad658 (patch) | |
| tree | 888fd07f8dac722c913cb3bd7358dd20dafce70c /include/stc | |
| parent | 9d5766ae528595050dcfe0db4c1c3c0c058b186c (diff) | |
| download | STC-modified-ba3f2284731e50100d249cf1d825b8d24efad658.tar.gz STC-modified-ba3f2284731e50100d249cf1d825b8d24efad658.zip | |
removing compiler warning ++.
Diffstat (limited to 'include/stc')
| -rw-r--r-- | include/stc/algo/filter.h | 9 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 2 | ||||
| -rw-r--r-- | include/stc/cmap.h | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/include/stc/algo/filter.h b/include/stc/algo/filter.h index e133577c..db076ae4 100644 --- a/include/stc/algo/filter.h +++ b/include/stc/algo/filter.h @@ -89,8 +89,7 @@ int main() // Use with: clist, cmap, cset, csmap, csset: #define c_erase_if(it, C, cnt, pred) do { \ C* _cnt = &cnt; \ - intptr_t _index = 0; \ - for (C##_iter it = C##_begin(_cnt); it.ref; ++_index) { \ + for (C##_iter it = C##_begin(_cnt); it.ref; ) { \ if (pred) it = C##_erase_at(_cnt, it); \ else C##_next(&it); \ } \ @@ -100,11 +99,11 @@ int main() // Use with: cstack, cvec, cdeq, cqueue: #define c_eraseremove_if(it, C, cnt, pred) do { \ C* _cnt = &cnt; \ - intptr_t _n = 0, _index = 0; \ + intptr_t _n = 0; \ C##_iter it = C##_begin(_cnt), _i; \ while (it.ref && !(pred)) \ - C##_next(&it), ++_index; \ - for (_i = it; it.ref; C##_next(&it), ++_index) \ + C##_next(&it); \ + for (_i = it; it.ref; C##_next(&it)) \ if (pred) C##_value_drop(it.ref), ++_n; \ else *_i.ref = *it.ref, C##_next(&_i); \ _cnt->_len -= _n; \ diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index 4f9fa398..73a3d5ef 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -147,7 +147,7 @@ STC_INLINE uint64_t cfasthash(const void* key, intptr_t len) { case 0: return 1; } const uint8_t *x = (const uint8_t*)key; - uint64_t h = *x << 7, n = (uint64_t)len >> 3; + uint64_t h = (uint64_t)*x << 7, n = (uint64_t)len >> 3; len &= 7; while (n--) { memcpy(&u8, x, 8), x += 8; diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 65e4a544..9f21b811 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -422,7 +422,7 @@ _cx_memb(_reserve)(_cx_self* self, const intptr_t _newcap) { return true; intptr_t _newbucks = (intptr_t)((float)_newcap / (i_max_load_factor)) + 4; #if i_expandby == 2 - _newbucks = (intptr_t)next_power_of_2(_newbucks); + _newbucks = (intptr_t)next_power_of_2((uint64_t)_newbucks); #else _newbucks |= 1; #endif |
