diff options
| author | Tyge Løvset <[email protected]> | 2023-02-12 22:47:55 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-12 23:20:18 +0100 |
| commit | 7dc6fddc079f4f572c8fb7c0ffd5a27e03291a2d (patch) | |
| tree | 681d1894d917bc2fe244375298ea40f736c18e18 /include/stc/algo/filter.h | |
| parent | 9904a7ea36f9e4f45d7e41e409ed23ad22821e8a (diff) | |
| download | STC-modified-7dc6fddc079f4f572c8fb7c0ffd5a27e03291a2d.tar.gz STC-modified-7dc6fddc079f4f572c8fb7c0ffd5a27e03291a2d.zip | |
Fairly large update before release 4.1, cleaning up docs and some minor additions.
Diffstat (limited to 'include/stc/algo/filter.h')
| -rw-r--r-- | include/stc/algo/filter.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/stc/algo/filter.h b/include/stc/algo/filter.h index b2b59fa6..8357cb4d 100644 --- a/include/stc/algo/filter.h +++ b/include/stc/algo/filter.h @@ -57,6 +57,8 @@ int main() #define c_flt_skip(i, n) (++(i).s1[(i).s1top++] > (n)) #define c_flt_skipwhile(i, pred) ((i).s2[(i).s2top++] |= !(pred)) #define c_flt_takewhile(i, pred) !c_flt_skipwhile(i, pred) +#define c_flt_last(i) (i).s1[(i).s1top-1] +#define c_flt_lastwhile(i) (i).s2[(i).s2top-1] #define c_forfilter(...) c_MACRO_OVERLOAD(c_forfilter, __VA_ARGS__) @@ -68,10 +70,10 @@ int main() #define c_forfilter_B(i, C, start, filter) \ for (struct {C##_iter it; C##_value *ref; \ - uint32_t s1[c_NFILTERS], index, count; \ + uint32_t s1[c_NFILTERS], index; \ bool s2[c_NFILTERS]; uint8_t s1top, s2top;} \ i = {.it=start, .ref=i.it.ref}; i.it.ref \ ; C##_next(&i.it), i.ref = i.it.ref, ++i.index, i.s1top=0, i.s2top=0) \ - if (!((filter) && ++i.count)) ; else + if (!(filter)) ; else #endif |
