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
a360969ec6
[BitArray] Add masking and resizing shifts
2023-01-31 18:04:30 -08:00
Karoy Lorentey
866d00798f
[BitArray] Add LosslessStringConvertible conformance
2023-01-31 18:02:16 -08:00
Karoy Lorentey
17343b752a
[BitArray] fill(in:with:), insert(repeating:count:at:), append(repeating:count:)
2023-01-31 18:01:46 -08:00
Karoy Lorentey
a90b73966a
[BitArray] Add conformance to ExpressibleByStringLiteral
2023-01-31 18:00:27 -08:00
Karoy Lorentey
a8bde63439
[BitArray] Add toggleAll(), toggleAll(in:)
2023-01-31 17:59:56 -08:00
Karoy Lorentey
c15b0d9889
[BitArray] Add BitArray → BinaryInteger conversion initializers
...
extension BinaryInteger {
public init(truncatingIfNeeded source: BitArray)
public init?(exactly source: BitArray)
public init(_ source: BitArray)
}
2023-01-31 17:59:24 -08:00
Karoy Lorentey
c15e484f5a
[BitArray] Add init(minimumCapacity:)
2023-01-31 17:43:06 -08:00
Karoy Lorentey
4281dc4482
[BitArray] Change description to print bit arrays as binary numerals
...
This matches std::bitset, and it seems to be the more logical option.
2023-01-31 17:39:46 -08:00
Karoy Lorentey
03b62ffb6e
[BitArray] random(count:using:) → randomBits(count:using:)
2023-01-31 17:33:55 -08:00
Karoy Lorentey
6cb03fee98
[BitCollections] Update file headers
2023-01-31 17:30:39 -08:00
Karoy Lorentey
a2f4b18ae0
[BitSet, OrderedCollections] Unify UnsafeBitSet implementations
2022-11-28 16:30:55 -08:00
Karoy Lorentey
f76630db8e
[Internals] Add missing internal checking predicates & docs for all
2022-10-18 22:13:19 -07:00
Karoy Lorentey
541bd53958
[BitCollections] Move shared utilities to _CollectionsUtilities
2022-10-09 20:11:51 -07:00
Karoy Lorentey
14432582dc
[BitArray] Explicitly conform to Sendable
2022-10-05 11:33:31 -07: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
5bc22eaf9b
[BitArray] Add docs.
2022-08-25 23:50:35 -07:00
Karoy Lorentey
fcac09d86a
[BitSet, BitArray] Add random factories
2022-08-25 22:21:34 -07:00
Karoy Lorentey
544507ee62
[BitArray] Add some docs.
2022-08-25 20:26:48 -07:00
Karoy Lorentey
d8d9c5ea25
[BitSet] Add documentation
2022-08-16 19:01:11 -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
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
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
537382f2a6
BitArrayModule ⟹ BitCollections
2021-12-28 15:45:38 -08:00