Commit Graph
19 Commits
Author SHA1 Message Date
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
Karoy Lorentey a0da2df799 [BitArray] Update LosslessStringConvertible initializer to accept new description format 2024-01-31 19:34:36 -08:00
Karoy Lorentey ae641c3d5d [BitArray] Fix description implementation; update tests 2024-01-31 19:34:36 -08:00
Karoy Lorentey e01391e562 [BitArray] Fix logic error in toggleAll()
D’oh — lucky the test coverage caught this; unlucky that the test wasn’t deterministic, and the chances of this occurring were quite low.
2024-01-31 19:34:36 -08:00
Karoy Lorentey de8ba5d7ad [BitArray] Disable bitwise operators for now
The current family of operations is far too restrictive, and the generalization is a topic of ongoing investigation. In particular, the operator syntax seems unlikely to survive when we want to support operations over slices.

Don’t ship BitArray with API that we’ll potentially regret; instead, just leave these off for now.
2024-01-29 17:01:00 -08:00
Karoy Lorentey 09c09f0f73 Fix CustomStringConvertible/CustomDebugStringConvertible conformances
- For CustomStringConvertible, `description` should print elements using `String(reflecting:)` rather than `String(describing:)`, to avoid element output from interfering with syntactically relevant punctuation within structured list displays.
- To make this work without making displays overly verbose, make `debugDescription` mostly the same as `description`, except for escaping raw string displays when and if needed.
- Avoid printing type names in `debugDescription` — it is generally not helpful, as the type is already easily accessible elsewhere. Including it makes for overly verbose displays when the type serves as an Element of a collection.
- Avoid having `debugDescription` return the empty string — it can be confusing when such a description appears in list displays.

Resolves #301.
2023-07-06 17:25:11 -07:00
Karoy Lorentey 8ca5c0367f Merge pull request #263 from lorentey/bitcollections-finalization
BitArray API refinements & additions
2023-04-10 17:32:10 -07:00
Karoy Lorentey cbab9e3737 Introduce COLLECTIONS_SINGLE_MODULE condition 2023-03-21 18:42:33 -07:00
Karoy Lorentey 3e6df33472 [BitArray] Update tests 2023-01-31 18:04:41 -08:00
Károly Lőrentey 141ef3c706 [BitArray] Use a platform-independent Codable encoding 2022-09-04 19:26:46 -07:00
Karoy Lorentey 5fe91efeba [BitArray] Add Codable conformance 2022-08-28 17:32:46 -07:00
Karoy Lorentey bae950193f [BitArray] Add Custom[Debug]StringConvertible and CustomReflectable conformances 2022-08-26 14:19:56 -07:00
Karoy Lorentey fcac09d86a [BitSet, BitArray] Add random factories 2022-08-25 22:21:34 -07:00
Karoy Lorentey 94e2e477db [BitArray] Add truncateOrExtend method
This comes handy to e.g. restore the original count of a bit array
after a BitArray→BitSet→BitArray conversion roundtrip.
2022-08-16 15:43:34 -07:00
Karoy Lorentey 565c09e8d5 Review & update BitArray 2022-02-06 22:38:35 -08: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
Károly Lőrentey b33bd007d6 Remove benchmark results from source root 2022-01-10 17:10:23 -08:00
Károly Lőrentey 537382f2a6 BitArrayModule ⟹ BitCollections 2021-12-28 15:45:38 -08:00