@@ -491,18 +491,14 @@ pub struct ChunkedBitSet<T> {
491
491
marker : PhantomData < T > ,
492
492
}
493
493
494
- // Note: the chunk domain size is duplicated in each variant. This is a bit
495
- // inconvenient, but it allows the type size to be smaller than if we had an
496
- // outer struct containing a chunk domain size plus the `Chunk`, because the
497
- // compiler can place the chunk domain size after the tag.
494
+ // NOTE: The chunk size is computed on-the-fly on each manipulation of a chunk.
495
+ // This avoids storing it, as it's almost always CHUNK_BITS except for the last one.
498
496
#[ derive( Clone , Debug , PartialEq , Eq ) ]
499
497
enum Chunk {
500
498
/// A chunk that is all zeros; we don't represent the zeros explicitly.
501
- /// The `ChunkSize` is always non-zero.
502
499
Zeros ,
503
500
504
501
/// A chunk that is all ones; we don't represent the ones explicitly.
505
- /// `ChunkSize` is always non-zero.
506
502
Ones ,
507
503
508
504
/// A chunk that has a mix of zeros and ones, which are represented
@@ -514,9 +510,7 @@ enum Chunk {
514
510
/// to store the length, which would make this type larger. These excess
515
511
/// words are always zero, as are any excess bits in the final in-use word.
516
512
///
517
- /// The first `ChunkSize` field is always non-zero.
518
- ///
519
- /// The second `ChunkSize` field is the count of 1s set in the chunk, and
513
+ /// The `ChunkSize` field is the count of 1s set in the chunk, and
520
514
/// must satisfy `0 < count < chunk_domain_size`.
521
515
///
522
516
/// The words are within an `Rc` because it's surprisingly common to
0 commit comments