diff options
| author | Tyge Løvset <[email protected]> | 2023-01-14 00:05:33 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-01-14 00:08:57 +0100 |
| commit | c5e071c622d6f460aa1ad07b6543ceaaed5209fc (patch) | |
| tree | d5aad0ee32f47d57301cce8ded60226bd328c98b /include/stc/cpque.h | |
| parent | bb92cdbeaa279d8ef90dff0cf088585a50e7d52c (diff) | |
| download | STC-modified-c5e071c622d6f460aa1ad07b6543ceaaed5209fc.tar.gz STC-modified-c5e071c622d6f460aa1ad07b6543ceaaed5209fc.zip | |
Merged cmspan into cspan. cspan is now multi-dimensional array view (also 1-dimensional).
Diffstat (limited to 'include/stc/cpque.h')
| -rw-r--r-- | include/stc/cpque.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/cpque.h b/include/stc/cpque.h index 74e0a5b7..28b5eb86 100644 --- a/include/stc/cpque.h +++ b/include/stc/cpque.h @@ -112,11 +112,11 @@ STC_INLINE void _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) STC_DEF void _cx_memb(_sift_down_)(_cx_self* self, const size_t idx, const size_t n) { - _cx_value* arr = self->data - 1; + _cx_value t, *arr = self->data - 1; for (size_t r = idx, c = idx*2; c <= n; c *= 2) { - c += (c < n && (i_less_functor(self, (&arr[c]), (&arr[c + 1])))); + c += i_less_functor(self, (&arr[c]), (&arr[c + (c < n)])); if (!(i_less_functor(self, (&arr[r]), (&arr[c])))) return; - _cx_value t = arr[r]; arr[r] = arr[c]; arr[r = c] = t; + t = arr[r], arr[r] = arr[c], arr[r = c] = t; } } |
