Repository navigation
Commit 487bdba
authored
Add for_each_unset_index to BitBuffer (#10866)
Add `for_each_unset_index` to `BitBuffer`
## Summary
- Tracking Issue: #10605
`BitBuffer::for_each_set_index` visits every set bit, but nothing does
the same for unset bits. The `Unary` encoding in #10609 needs that: each
value ends with an unset bit, so a full decode is one walk over the
unset bits.
## Changes
- `BitBuffer::for_each_unset_index(f)` calls `f(index)` for every unset
bit, in ascending order.
- It shares one scan with `try_for_each_set_index`, through a private
`try_for_each_index` that takes a `const UNSET: bool`. `select` and
`select_unset` share their kernels the same way. With `UNSET`, each word
is inverted as it is read. - The last word is zero padded past `len`.
For unset bits, the padding is set before inverting, so it is never
visited.
---------
Signed-off-by: rapour <[email protected]>1 parent a412a53 commit 487bdba
1 file changed
Lines changed: 67 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
562 | 562 | | |
563 | 563 | | |
564 | 564 | | |
565 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
566 | 588 | | |
567 | 589 | | |
568 | 590 | | |
569 | 591 | | |
570 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
571 | 602 | | |
572 | 603 | | |
573 | 604 | | |
| |||
805 | 836 | | |
806 | 837 | | |
807 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
808 | 842 | | |
| 843 | + | |
809 | 844 | | |
810 | 845 | | |
811 | 846 | | |
| |||
1150 | 1185 | | |
1151 | 1186 | | |
1152 | 1187 | | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1153 | 1219 | | |
1154 | 1220 | | |
1155 | 1221 | | |
| |||
0 commit comments