Adding a sorted array to an inverted set delegates to the underlying deletion path, but set_sorted_array() always added bits. Excluded members stayed excluded, and existing included members could become excluded.
Use the requested bit value, as set_array() already does. The regression covers duplicates, excluded and included members, and both existing and absent pages.
Assisted-by: OpenAI Codex
Copy assignment resets the destination before reading the source. When
they are the same vector, this also clears the source. In particular,
hb_set_set(set, set) loses the set's stored pages.
Return immediately for self assignment. Cover trivial and nontrivial
vector elements and public set assignment in both inversion modes.
Validation: both regressions fail before the fix; meson test -C build
passes (261 passed, 1 skipped).
Assisted-by: OpenAI Codex
Deleting the last member of a page leaves an empty page in the sparse set. `hb_bit_page_t::get_max()` returned zero for that page, so reverse iteration could report a value that was never in the set. For example, add and delete 512, then iterate backward from 1024: HarfBuzz reported 512 from an empty set.
Return INVALID for an empty page, matching get_min(), so previous() skips it. Cover reverse scalar/range iteration with retained empty pages, including inverted sets.
Assisted-by: OpenAI Codex
The mixed-inversion equality path compares zipped iterators, which stop
at the shorter set. An empty set therefore compares equal to a full
inverted set, as does any matching finite prefix.
Check populations before comparing members and add regression coverage
for empty sets and matching prefixes in both argument orders.
Validation: meson test -C build (261 passed, 1 skipped).
Assisted-by: OpenAI Codex
When the cursor's page is absent, bfind selects the next stored page.
Using the cursor's offset in that different page can skip its members,
or skip the entire page when the cursor ends on a page boundary.
Apply the cursor offset only when the selected page matches its major
index. Cover batch and scalar iterator agreement across missing pages
for both ordinary and inverted sets.
Validation: the new regression fails before the fix; meson test -C build
passes (261 passed, 1 skipped).
Assisted-by: OpenAI Codex
Expose the exact set-intersection query so callers can test whether two
sets have any elements in common without copying and mutating a set.
The implementation handles inverted sets through the internal helper.
Document the new API with its release placeholder, add it to the docs
section index, and cover regular and inverted set combinations.
Tested with the full Meson test suite (270/270 passed).
Assisted-by: OpenAI Codex <codex@openai.com>
1. If smaller set has empty pages the subset checking logic was incorrectly incrementing the larger page index after skipping the empty smaller page index.
2. The logic for is_subset() on mixed inverted/not inverted sets was wrong.
If a process operation results in less pages then the current set has, it will likely corrupt the page_map since it overwrites page_map entries ahead of where it's processing. This fixes that problem by removing page_map entries that will be dropped. Then dropping orphaned pages and re-indexing retained pages.