Lines Matching refs:bucket
30 struct Bucket {
31 // The collision flag indicates that the bucket is part of a collision chain
32 // such that at least two entries both hash to this bucket. When true, we
36 // The present flag indicates that the bucket contains an initialized entry value.
39 // Mask for 30 bits worth of the hash code that are stored within the bucket to
73 const size_t mBucketSize; // number of bytes per bucket including the entry
82 inline const Bucket& bucketAt(const void* __restrict__ buckets, size_t index) const {
83 return *reinterpret_cast<const Bucket*>(
87 inline Bucket& bucketAt(void* __restrict__ buckets, size_t index) const {
88 return *reinterpret_cast<Bucket*>(static_cast<uint8_t*>(buckets) + index * mBucketSize);
91 virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const = 0;
92 virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const = 0;
93 virtual void destroyBucketEntry(Bucket& bucket) const = 0;
98 // Allocates a bucket array as a SharedBuffer.
101 // Releases a bucket array's associated SharedBuffer.
105 // populated bucket if needed).
109 // for each populated bucket if needed).
113 // Determines the appropriate size of a bucket array to store a certain minimum
118 // Trim a hash code to 30 bits to match what we store in the bucket's cookie.
120 return (hash & Bucket::HASH_MASK) ^ (hash >> 30);
123 // Returns the index of the first bucket that is in the collision chain
130 // Returns the increment to add to a bucket index to seek to the next bucket
137 // Returns the index of the next bucket that is in the collision chain
340 static inline const TEntry& entryFor(const Bucket& bucket) {
341 return reinterpret_cast<const TEntry&>(bucket.entry);
344 static inline TEntry& entryFor(Bucket& bucket) {
345 return reinterpret_cast<TEntry&>(bucket.entry);
348 virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const;
349 virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const;
350 virtual void destroyBucketEntry(Bucket& bucket) const;
377 bool BasicHashtable<TKey, TEntry>::compareBucketKey(const Bucket& bucket,
379 return entryFor(bucket).getKey() == *static_cast<const TKey*>(key);
383 void BasicHashtable<TKey, TEntry>::initializeBucketEntry(Bucket& bucket,
386 new (&entryFor(bucket)) TEntry(*(static_cast<const TEntry*>(entry)));
388 memcpy(&entryFor(bucket), entry, sizeof(TEntry));
393 void BasicHashtable<TKey, TEntry>::destroyBucketEntry(Bucket& bucket) const {
395 entryFor(bucket).~TEntry();