• Home
  • Raw
  • Download

Lines Matching full:bucket

35 // - Enums are stored in buckets (64 contiguous values max per bucket)
42 // - bucket 0, storing values in the range [ 0; 64[
43 // - bucket 1, storing values in the range [64; 128[
45 // - Buckets are stored in a sorted vector (sorted by bucket range).
46 // - Retrieval is done by computing the theoretical bucket index using the enum
49 // - Insertion is done by retrieving the bucket and either:
50 // - inserting a new bucket in the sorted vector when no buckets has a
52 // - setting the corresponding bit in the bucket.
54 // bucket is available. In our case, this happens at most 23 times for the
65 // Each bucket can hold up to `kBucketSize` distinct, contiguous enum values.
66 // The first value a bucket can hold must be aligned on `kBucketSize`.
67 struct Bucket { struct
70 // 1st enum this bucket can represent.
73 friend bool operator==(const Bucket& lhs, const Bucket& rhs) { argument
78 // How many distinct values can a bucket hold? 1 bit per value.
150 // Index of the bucket in the vector.
152 // Offset in bits in the current bucket.
242 auto& bucket = buckets_[index]; in insert() local
244 if (bucket.data & mask) { in insert()
249 bucket.data |= ComputeMaskForValue(value); in insert()
286 auto& bucket = buckets_[index]; in erase() local
288 if (!(bucket.data & mask)) { in erase()
293 bucket.data &= ~mask; in erase()
294 if (bucket.data == 0) { in erase()
307 auto& bucket = buckets_[index]; in contains() local
308 return bucket.data & ComputeMaskForValue(value); in contains()
342 // LHS bucket is smaller than the current RHS bucket. Catching up on RHS. in HasAnyOf()
356 // Returns the index of the last bucket in which `value` could be stored.
361 // Returns the smallest enum value that could be contained in the same bucket
368 // Returns the index of the bit that corresponds to `value` in the bucket.
373 // Returns the bitmask used to represent the enum `value` in its bucket.
378 // Returns the `enum` stored in `bucket` at `offset`.
379 // `offset` is the bit-offset in the bucket storage.
380 static constexpr inline T GetValueFromBucket(const Bucket& bucket, in GetValueFromBucket() argument
382 return static_cast<T>(static_cast<ElementType>(bucket.start) + offset); in GetValueFromBucket()
385 // For a given enum `value`, finds the bucket index that could contain this
386 // value. If no such bucket is found, the index at which the new bucket should
402 // - The bucket matches in FindBucketForValue()
403 // => returns the bucket index. in FindBucketForValue()
404 // - The found bucket is larger in FindBucketForValue()
405 // => scans left until it finds the correct bucket, or insertion point. in FindBucketForValue()
406 // - The found bucket is smaller in FindBucketForValue()
417 // Creates a new bucket to store `value` and inserts it at `index`.
418 // If the `index` is past the end, the bucket is inserted at the end of the
422 Bucket bucket = {1ULL << ComputeBucketOffset(value), bucket_start}; in InsertBucketFor() local
423 auto it = buckets_.emplace(buckets_.begin() + index, std::move(bucket)); in InsertBucketFor()
433 // Returns true if the bucket at `bucketIndex/ stores the enum at
459 std::vector<Bucket> buckets_;