23 Commits
Author SHA1 Message Date
Karoy Lorentey d07dc32dfa Sources: Add unsafe keywords where needed 2026-10-01 11:14:29 -07:00
hxperl 80216ab026 Unbacktick parameter names so DocC binds the parameter docs
Six `- Parameter` entries in `Deque` and `BitSet` write the parameter
name inside backticks (``- Parameter `i`:``). DocC binds parameter
documentation by bare identifier, so these never attach: no Parameters
section is rendered at all, and the entry instead falls into the
Discussion as a literal "Parameter `i`: ..." bullet, which also swallows
the `- Complexity:` callout that follows it.

Dropping the backticks around the name restores the Parameters section on
all six pages. Backticks inside the description text are left alone.
2026-09-11 14:07:13 +09:00
Karoy Lorentey 084be39d7e [BitSet] Add makeIterator(from:)
This enables faster iteration over subranges of a BitSet than the `Slice` type’s default indexing iterator. (Depending on the fill factor, the speedup can be as high as 4x — not insignificant.)
2026-04-21 16:28:14 -07:00
Karoy Lorentey 80878519f2 [doc] Fix most issues reported by docc
DocC keeps changing its link syntax. The latest iteration appears to have trouble dealing with `Self`-taking or `Self`-returning methods, so change our API to replace `Self` with a direct mention of the concrete type. ¯\\\_(ツ)\_/¯

That said, the new compiler also found a large number of mismatching parameter names, and that was really helpful.
2026-03-09 14:14:51 -07:00
Karoy Lorentey 1c69635852 Add SPDX-License-Identifier tags 2026-03-05 19:39:24 -08:00
Karoy Lorentey d9b09ecde8 Update copyright dates 2026-03-05 19:39:20 -08:00
Nate Cook 54ca53612f Include notes about index mutation in span(after/before:)
The indexes passed to span(after:) and friends on UniqueArray
and RigidArray are modified before return. This adds notes
about the updated values to the method documentation, along
with a few other minor formatting changes (dropping smart
quotes, single-sentence abstracts).
2026-03-02 16:38:48 -08:00
faimin f6256df262 Add the missing macro condition when import InternalCollectionsUtilities 2025-07-30 14:44:22 +08:00
Karoy Lorentey 6819c6d149 Enable MemberImportVisibility and fix issues uncovered 2025-05-20 18:11:44 -07:00
Karoy Lorentey 3bc1c3be46 [BitCollections] Update copyright dates 2024-01-30 18:09:37 -08:00
Karoy Lorentey a8dad62bc9 Remove obsolete swift(>=5.5)/swift(>=5.6) checks 2023-04-10 18:33:52 -07:00
Karoy Lorentey a2f4b18ae0 [BitSet, OrderedCollections] Unify UnsafeBitSet implementations 2022-11-28 16:30:55 -08:00
Karoy Lorentey d2d2da6f3f [BitSet] BitSet, BitSet.Iterator, BitSet.Index, BitSet.Counted: Explicitly conform to Sendable 2022-10-05 11:33:49 -07:00
Karoy Lorentey 464d973bf3 [BitSet] Remove precalculated count. Add BitSet.Counted wrapper for use cases that require it.
This results in a significant speedup for both individual
insert/remove operations as well as bulk set operations -
up to 4x.

Use cases that require an O(1) count can use the separate
BitSet.Counted type.
2022-08-31 13:04:51 -07:00
Karoy Lorentey 1c9c9fc664 [BitSet] Validate index passed to subscript in debug builds 2022-08-31 11:37:04 -07:00
Karoy Lorentey d6e585f84e [BitSet] Add index validation assertions
Only asserts, not preconditions, as passing invalid indices here
cannot lead to out-of-bounds access — we have unconditional
bounds checks later.
2022-08-29 22:40:03 -07:00
Karoy Lorentey 54d47c1e23 [BitSet] Add docs. 2022-08-26 00:09:13 -07:00
Karoy Lorentey 65976b8d85 [BitSet] Add some docs. 2022-08-25 20:26:48 -07:00
Karoy Lorentey 1aed39e0c6 [BitSet] Implement fancy index methods 2022-08-25 20:26:48 -07:00
Karoy Lorentey d8d9c5ea25 [BitSet] Add documentation 2022-08-16 19:01:11 -07:00
Karoy Lorentey cbf933665b [BitSet] Revert to non-generic BitSet
Also, remove members that were generic over FixedWidthInteger.
2022-08-12 19:22:24 -07:00
Károly Lőrentey 1d1fbc82d4 [BitSet] Make BitSet generic over its Element
This gets rid of the weird asymmetry between reading the contents of a BitSet (where we used to always get Int values) and mutating it (where we used to be able to give it values fo any fixed-width integer type).
2022-07-30 23:25:53 -07:00
Károly Lőrentey 8f2e0c79c3 Review & update BitSet
This is a work in progress; in particular, it adds a cached `count` to BitSet, which may turn out to be a bad idea. (It generates extra work for bulk operations even if the count is never needed.) I think replacing this with a cached `startIndex` might be more useful in practice.

The `_UnsafeBitset` type from the OrderedCollections module is brought over as `BitSet._UnsafeHandle`. This implements an (internal-only) fixed-size bitset.

`BitSet` now conforms to `SetAlgebra`. We decided against this in the initial implementation, but on reflection, it seems like the right move. (The somewhat nonsensical `insert` and `update` methods are unfortunate, but consistency is valuable.)
2022-01-10 23:35:33 -08:00