GCC Code Coverage Report


Directory: cvmfs/
File: cvmfs/smallhash.h
Date: 2025-09-28 02:35:26
Exec Total Coverage
Lines: 259 263 98.5%
Branches: 88 110 80.0%

Line Branch Exec Source
1 /**
2 * This file is part of the CernVM File System.
3 */
4
5 #ifndef CVMFS_SMALLHASH_H_
6 #define CVMFS_SMALLHASH_H_
7
8 #ifndef __STDC_FORMAT_MACROS
9 // NOLINTNEXTLINE
10 #define __STDC_FORMAT_MACROS
11 #endif
12
13 #include "duplex_testing.h"
14 #include <inttypes.h>
15 #include <pthread.h>
16 #include <stdint.h>
17
18 #include <algorithm>
19 #include <cassert>
20 #include <cstdlib>
21 #include <new>
22
23 #include "util/atomic.h"
24 #include "util/murmur.hxx"
25 #include "util/prng.h"
26 #include "util/smalloc.h"
27
28 /**
29 * Hash table with linear probing as collision resolution. Works only for
30 * a fixed (maximum) number of elements, i.e. no resizing. Load factor fixed
31 * to 0.7.
32 */
33 template<class Key, class Value, class Derived>
34 class SmallHashBase {
35 FRIEND_TEST(T_Smallhash, InsertAndCopyMd5Slow);
36
37 public:
38 static const double kLoadFactor; // mainly useless for the dynamic version
39 static const double kThresholdGrow; // only used for resizable version
40 static const double kThresholdShrink; // only used for resizable version
41
42 124129 SmallHashBase() {
43 124129 keys_ = NULL;
44 124129 values_ = NULL;
45 124129 hasher_ = NULL;
46 124129 bytes_allocated_ = 0;
47 124129 num_collisions_ = 0;
48 124129 max_collisions_ = 0;
49
50 // Properly initialized by Init()
51 124129 capacity_ = 0;
52 124129 initial_capacity_ = 0;
53 124129 size_ = 0;
54 124129 }
55
56 123991 ~SmallHashBase() { DeallocMemory(keys_, values_, capacity_); }
57
58 124065 void Init(uint32_t expected_size, Key empty,
59 uint32_t (*hasher)(const Key &key)) {
60 124065 hasher_ = hasher;
61 124065 empty_key_ = empty;
62 124065 capacity_ = static_cast<uint32_t>(static_cast<double>(expected_size)
63 124065 / kLoadFactor);
64 124065 initial_capacity_ = capacity_;
65 124065 static_cast<Derived *>(this)->SetThresholds(); // No-op for fixed size
66 124065 AllocMemory();
67 124065 this->DoClear(false);
68 124065 }
69
70 70108123 bool Lookup(const Key &key, Value *value) const {
71 uint32_t bucket;
72 uint32_t collisions;
73
1/2
✓ Branch 1 taken 70101840 times.
✗ Branch 2 not taken.
70108123 const bool found = DoLookup(key, &bucket, &collisions);
74
2/2
✓ Branch 0 taken 68533441 times.
✓ Branch 1 taken 1568399 times.
70115446 if (found)
75
1/2
✓ Branch 1 taken 10758 times.
✗ Branch 2 not taken.
68537991 *value = values_[bucket];
76 70115446 return found;
77 }
78
79 /**
80 * Returns both the key and the value. That is useful if Key's equality
81 * operator implements an equivalence relation on Key. In this case, LookupEx
82 * returns the key representing the equivalence class that has been used
83 * during Insert().
84 * Used to return a glue::InodeEx element when looking for an inode.
85 */
86 408 bool LookupEx(Key *key, Value *value) const {
87 408 uint32_t bucket = ScaleHash(*key);
88
2/2
✓ Branch 1 taken 136 times.
✓ Branch 2 taken 68 times.
408 while (!(keys_[bucket] == empty_key_)) {
89
1/2
✓ Branch 1 taken 136 times.
✗ Branch 2 not taken.
272 if (keys_[bucket] == *key) {
90 272 *key = keys_[bucket];
91 272 *value = values_[bucket];
92 272 return true;
93 }
94 bucket = (bucket + 1) % capacity_;
95 }
96 136 return false;
97 }
98
99 5038816 bool Contains(const Key &key) const {
100 uint32_t bucket;
101 uint32_t collisions;
102
1/2
✓ Branch 1 taken 5038557 times.
✗ Branch 2 not taken.
5038816 const bool found = DoLookup(key, &bucket, &collisions);
103 5038816 return found;
104 }
105
106 1909661533 void Insert(const Key &key, const Value &value) {
107 1909661533 static_cast<Derived *>(this)->Grow(); // No-op if fixed-size
108 1903691087 const bool overwritten = DoInsert(key, value, true);
109 1900989538 size_ += !overwritten; // size + 1 if the key was not yet in the map
110 1900989538 }
111
112 107966857 bool Erase(const Key &key) {
113 uint32_t bucket;
114 uint32_t collisions;
115
1/2
✓ Branch 1 taken 104398122 times.
✗ Branch 2 not taken.
107966857 const bool found = DoLookup(key, &bucket, &collisions);
116
1/2
✓ Branch 0 taken 104409128 times.
✗ Branch 1 not taken.
104401737 if (found) {
117 104412403 keys_[bucket] = empty_key_;
118 104412403 size_--;
119 104412403 bucket = (bucket + 1) % capacity_;
120
3/3
✓ Branch 0 taken 154556201 times.
✓ Branch 1 taken 88241417 times.
✓ Branch 2 taken 18051328 times.
260852221 while (!(keys_[bucket] == empty_key_)) {
121 157671082 Key rehash = keys_[bucket];
122 157671082 keys_[bucket] = empty_key_;
123
1/2
✓ Branch 1 taken 156439818 times.
✗ Branch 2 not taken.
157671082 DoInsert(rehash, values_[bucket], false);
124 156439818 bucket = (bucket + 1) % capacity_;
125 }
126
1/2
✓ Branch 1 taken 105548028 times.
✗ Branch 2 not taken.
103181139 static_cast<Derived *>(this)->Shrink(); // No-op if fixed-size
127 }
128 105550051 return found;
129 }
130
131 2226 void Clear() { DoClear(true); }
132
133 3256 uint64_t bytes_allocated() const { return bytes_allocated_; }
134 468 static double GetEntrySize() {
135 936 const double unit = sizeof(Key) + sizeof(Value);
136 936 return unit / kLoadFactor;
137 }
138
139 void GetCollisionStats(uint64_t *num_collisions,
140 uint32_t *max_collisions) const {
141 *num_collisions = num_collisions_;
142 *max_collisions = max_collisions_;
143 }
144
145 // Careful with the direct access TODO: iterator
146 uint32_t capacity() const { return capacity_; }
147 7034 Key empty_key() const { return empty_key_; }
148 26686 Key *keys() const { return keys_; }
149 307 Value *values() const { return values_; }
150
151 // Only needed by compat
152 void SetHasher(uint32_t (*hasher)(const Key &key)) { hasher_ = hasher; }
153
154 protected:
155 2541339332 uint32_t ScaleHash(const Key &key) const {
156 2541339332 const double bucket = (static_cast<double>(hasher_(key))
157 2533158783 * static_cast<double>(capacity_)
158 / static_cast<double>(static_cast<uint32_t>(-1)));
159 2533158783 return static_cast<uint32_t>(bucket) % capacity_;
160 }
161
162 267966 void AllocMemory() {
163 267966 keys_ = static_cast<Key *>(smmap(capacity_ * sizeof(Key)));
164 267966 values_ = static_cast<Value *>(smmap(capacity_ * sizeof(Value)));
165
2/2
✓ Branch 0 taken 1474838215 times.
✓ Branch 1 taken 135952 times.
2946983386 for (uint32_t i = 0; i < capacity_; ++i) {
166 2946715420 /*keys_[i] =*/new (keys_ + i) Key();
167 }
168
2/2
✓ Branch 0 taken 1476315015 times.
✓ Branch 1 taken 64016 times.
2949793114 for (uint32_t i = 0; i < capacity_; ++i) {
169 2949669020 /*values_[i] =*/new (values_ + i) Value();
170 }
171 124094 bytes_allocated_ = (sizeof(Key) + sizeof(Value)) * capacity_;
172 124094 }
173
174 267892 void DeallocMemory(Key *k, Value *v, uint32_t c) {
175
2/2
✓ Branch 0 taken 1477364777 times.
✓ Branch 1 taken 135914 times.
2952039166 for (uint32_t i = 0; i < c; ++i) {
176 2951771274 k[i].~Key();
177 }
178
2/2
✓ Branch 0 taken 1479922217 times.
✓ Branch 1 taken 135914 times.
2957154046 for (uint32_t i = 0; i < c; ++i) {
179 2956886154 v[i].~Value();
180 }
181
2/2
✓ Branch 0 taken 135882 times.
✓ Branch 1 taken 32 times.
267892 if (k)
182 267828 smunmap(k);
183
2/2
✓ Branch 0 taken 135882 times.
✓ Branch 1 taken 32 times.
267892 if (v)
184 267828 smunmap(v);
185 267892 k = NULL;
186 267892 v = NULL;
187 267892 }
188
189 // Returns true iff the key is overwritten
190 2210936063 bool DoInsert(const Key &key, const Value &value,
191 const bool count_collisions) {
192 uint32_t bucket;
193 uint32_t collisions;
194
1/2
✓ Branch 1 taken 1109094541 times.
✗ Branch 2 not taken.
2210936063 const bool overwritten = DoLookup(key, &bucket, &collisions);
195
2/2
✓ Branch 0 taken 953153601 times.
✓ Branch 1 taken 155940940 times.
2208485556 if (count_collisions) {
196 1901982162 num_collisions_ += collisions;
197 1901982162 max_collisions_ = std::max(collisions, max_collisions_);
198 }
199 2207441388 keys_[bucket] = key;
200
1/2
✓ Branch 1 taken 5211936 times.
✗ Branch 2 not taken.
2207441388 values_[bucket] = value;
201 2207441388 return overwritten;
202 }
203
204 2543368132 bool DoLookup(const Key &key, uint32_t *bucket, uint32_t *collisions) const {
205 2543368132 *bucket = ScaleHash(key);
206 2532247672 *collisions = 0;
207
3/3
✓ Branch 0 taken 3897285935 times.
✓ Branch 1 taken 1008677644 times.
✓ Branch 2 taken 265019654 times.
7619847724 while (!(keys_[*bucket] == empty_key_)) {
208
3/3
✓ Branch 0 taken 154498808 times.
✓ Branch 1 taken 3769155333 times.
✓ Branch 2 taken 153446491 times.
5440508396 if (keys_[*bucket] == key)
209 352908344 return true;
210 5087600052 *bucket = (*bucket + 1) % capacity_;
211 5087600052 (*collisions)++;
212 }
213 2179339328 return false;
214 }
215
216 267978 void DoClear(const bool reset_capacity) {
217
2/2
✓ Branch 0 taken 2226 times.
✓ Branch 1 taken 133738 times.
267978 if (reset_capacity)
218 3607 static_cast<Derived *>(this)->ResetCapacity(); // No-op if fixed-size
219
2/2
✓ Branch 0 taken 1479808323 times.
✓ Branch 1 taken 135964 times.
2956907234 for (uint32_t i = 0; i < capacity_; ++i)
220 2956639256 keys_[i] = empty_key_;
221 267978 size_ = 0;
222 267978 }
223
224 // Methods for resizable version
225 void SetThresholds() { }
226 void Grow() { }
227 void Shrink() { }
228 void ResetCapacity() { }
229
230 // Separate key and value arrays for better locality
231 Key *keys_;
232 Value *values_;
233 uint32_t capacity_;
234 uint32_t initial_capacity_;
235 uint32_t size_;
236 uint32_t (*hasher_)(const Key &key);
237 uint64_t bytes_allocated_;
238 uint64_t num_collisions_;
239 uint32_t max_collisions_; /**< maximum collisions for a single insert */
240 Key empty_key_;
241 };
242
243
244 template<class Key, class Value>
245 class SmallHashFixed
246 : public SmallHashBase<Key, Value, SmallHashFixed<Key, Value> > {
247 friend class SmallHashBase<Key, Value, SmallHashFixed<Key, Value> >;
248
249 protected:
250 // No-ops
251 3244 void SetThresholds() { }
252 1110910 void Grow() { }
253 9414 void Shrink() { }
254 12 void ResetCapacity() { }
255 };
256
257
258 template<class Key, class Value>
259 class SmallHashDynamic
260 : public SmallHashBase<Key, Value, SmallHashDynamic<Key, Value> > {
261 friend class SmallHashBase<Key, Value, SmallHashDynamic<Key, Value> >;
262
263 public:
264 typedef SmallHashBase<Key, Value, SmallHashDynamic<Key, Value> > Base;
265 static const double kThresholdGrow;
266 static const double kThresholdShrink;
267
268 120885 SmallHashDynamic() : Base() {
269 120885 num_migrates_ = 0;
270
271 // Properly set by Init
272 120885 threshold_grow_ = 0;
273 120885 threshold_shrink_ = 0;
274 120885 }
275
276 SmallHashDynamic(const SmallHashDynamic<Key, Value> &other) : Base() {
277 num_migrates_ = 0;
278 CopyFrom(other);
279 }
280
281 360 SmallHashDynamic<Key, Value> &operator=(
282 const SmallHashDynamic<Key, Value> &other) {
283
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
360 if (&other == this)
284 return *this;
285
286 360 CopyFrom(other);
287 360 return *this;
288 }
289
290 38904367 uint32_t capacity() const { return Base::capacity_; }
291 1076631335 uint32_t size() const { return Base::size_; }
292 uint32_t num_migrates() const { return num_migrates_; }
293
294 protected:
295 264594 void SetThresholds() {
296 264594 threshold_grow_ = static_cast<uint32_t>(static_cast<double>(capacity())
297 264658 * kThresholdGrow);
298 264658 threshold_shrink_ = static_cast<uint32_t>(static_cast<double>(capacity())
299 264658 * kThresholdShrink);
300 264658 }
301
302 1905262198 void Grow() {
303
2/2
✓ Branch 1 taken 48056 times.
✓ Branch 2 taken 953097919 times.
1905262198 if (size() > threshold_grow_)
304 96112 Migrate(capacity() * 2);
305 1903080693 }
306
307 104606772 void Shrink() {
308
2/2
✓ Branch 1 taken 19052416 times.
✓ Branch 2 taken 85812876 times.
104606772 if (size() < threshold_shrink_) {
309 19055691 const uint32_t target_capacity = capacity() / 2;
310
2/2
✓ Branch 0 taken 21984 times.
✓ Branch 1 taken 19030087 times.
19055346 if (target_capacity >= Base::initial_capacity_)
311 21984 Migrate(target_capacity);
312 }
313 104868254 }
314
315 3595 void ResetCapacity() {
316 3595 Base::DeallocMemory(Base::keys_, Base::values_, Base::capacity_);
317 3595 Base::capacity_ = Base::initial_capacity_;
318 3595 Base::AllocMemory();
319 3595 SetThresholds();
320 3595 }
321
322 private:
323 // Returns a random permutation of indices [0..N-1] that is allocated
324 // by smmap (Knuth's shuffle algorithm)
325 44424 uint32_t *ShuffleIndices(const uint32_t N) {
326 44424 uint32_t *shuffled = static_cast<uint32_t *>(smmap(N * sizeof(uint32_t)));
327 // Init with identity
328
2/2
✓ Branch 0 taken 357931284 times.
✓ Branch 1 taken 22212 times.
715906992 for (unsigned i = 0; i < N; ++i)
329 715862568 shuffled[i] = i;
330 // Shuffle (no shuffling for the last element)
331
1/2
✓ Branch 0 taken 340414960 times.
✗ Branch 1 not taken.
679929448 for (unsigned i = 0; i < N - 1; ++i) {
332 680829920 const uint32_t swap_idx = i + g_prng.Next(N - i);
333 679885024 const uint32_t tmp = shuffled[i];
334 679885024 shuffled[i] = shuffled[swap_idx];
335 679885024 shuffled[swap_idx] = tmp;
336 }
337 360 return shuffled;
338 }
339
340 140208 void Migrate(const uint32_t new_capacity) {
341 140208 Key *old_keys = Base::keys_;
342 140208 Value *old_values = Base::values_;
343 140208 const uint32_t old_capacity = capacity();
344 140208 const uint32_t old_size = size();
345
346 140144 Base::capacity_ = new_capacity;
347 140144 SetThresholds();
348 140208 Base::AllocMemory();
349 140272 Base::DoClear(false);
350
2/2
✓ Branch 0 taken 22016 times.
✓ Branch 1 taken 48120 times.
140272 if (new_capacity < old_capacity) {
351 44032 uint32_t *shuffled_indices = ShuffleIndices(old_capacity);
352
1/2
✓ Branch 0 taken 309383456 times.
✗ Branch 1 not taken.
618751040 for (uint32_t i = 0; i < old_capacity; ++i) {
353
2/3
✓ Branch 0 taken 77491680 times.
✓ Branch 1 taken 231891776 times.
✗ Branch 2 not taken.
618766912 if (old_keys[shuffled_indices[i]] != Base::empty_key_) {
354 154983360 Base::Insert(old_keys[shuffled_indices[i]],
355 154983360 old_values[shuffled_indices[i]]);
356 }
357 }
358 smunmap(shuffled_indices);
359 } else {
360
2/2
✓ Branch 0 taken 614467864 times.
✓ Branch 1 taken 33624 times.
1229002976 for (uint32_t i = 0; i < old_capacity; ++i) {
361
3/3
✓ Branch 0 taken 336290006 times.
✓ Branch 1 taken 236609391 times.
✓ Branch 2 taken 41568467 times.
1228935728 if (old_keys[i] != Base::empty_key_)
362 922008864 Base::Insert(old_keys[i], old_values[i]);
363 }
364 }
365
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 70136 times.
111280 assert(size() == old_size);
366
367 140272 Base::DeallocMemory(old_keys, old_values, old_capacity);
368 140272 num_migrates_++;
369 140272 }
370
371 360 void CopyFrom(const SmallHashDynamic<Key, Value> &other) {
372 360 uint32_t *shuffled_indices = ShuffleIndices(other.capacity_);
373
2/2
✓ Branch 0 taken 44043636 times.
✓ Branch 1 taken 196 times.
44047440 for (uint32_t i = 0; i < other.capacity_; ++i) {
374
2/3
✗ Branch 0 not taken.
✓ Branch 1 taken 32001722 times.
✓ Branch 2 taken 12041914 times.
44047080 if (other.keys_[shuffled_indices[i]] != other.empty_key_) {
375 32000000 this->Insert(other.keys_[shuffled_indices[i]],
376 32000000 other.values_[shuffled_indices[i]]);
377 }
378 }
379 360 smunmap(shuffled_indices);
380 360 }
381
382 uint32_t num_migrates_;
383 uint32_t threshold_grow_;
384 uint32_t threshold_shrink_;
385 static Prng g_prng;
386 };
387
388
389 /**
390 * Distributes the key-value pairs over $n$ dynamic hash maps with individual
391 * mutexes. Hence low mutex contention, and benefits from multiple processors.
392 */
393 template<class Key, class Value>
394 class MultiHash {
395 public:
396 320 MultiHash() {
397 320 num_hashmaps_ = 0;
398 320 hashmaps_ = NULL;
399 320 locks_ = NULL;
400 320 }
401
402 320 void Init(const uint8_t num_hashmaps, const Key &empty_key,
403 uint32_t (*hasher)(const Key &key)) {
404
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 320 times.
320 assert(num_hashmaps > 0);
405 320 const uint8_t N = num_hashmaps;
406 320 num_hashmaps_ = N;
407
3/4
✓ Branch 2 taken 13440 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13440 times.
✓ Branch 5 taken 320 times.
13760 hashmaps_ = new SmallHashDynamic<Key, Value>[N]();
408 320 locks_ = static_cast<pthread_mutex_t *>(
409 320 smalloc(N * sizeof(pthread_mutex_t)));
410
2/2
✓ Branch 0 taken 13440 times.
✓ Branch 1 taken 320 times.
13760 for (uint8_t i = 0; i < N; ++i) {
411 13440 int retval = pthread_mutex_init(&locks_[i], NULL);
412
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 13440 times.
13440 assert(retval == 0);
413 13440 hashmaps_[i].Init(128, empty_key, hasher);
414 }
415 320 }
416
417 320 ~MultiHash() {
418
2/2
✓ Branch 0 taken 13440 times.
✓ Branch 1 taken 320 times.
13760 for (uint8_t i = 0; i < num_hashmaps_; ++i) {
419 13440 pthread_mutex_destroy(&locks_[i]);
420 }
421 320 free(locks_);
422
3/4
✓ Branch 0 taken 320 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13440 times.
✓ Branch 3 taken 320 times.
13760 delete[] hashmaps_;
423 320 }
424
425 32000000 bool Lookup(const Key &key, Value *value) {
426 32000000 uint8_t target = SelectHashmap(key);
427 32000000 Lock(target);
428 32000000 const bool result = hashmaps_[target].Lookup(key, value);
429 32000000 Unlock(target);
430 32000000 return result;
431 }
432
433 119163520 void Insert(const Key &key, const Value &value) {
434 119163520 uint8_t target = SelectHashmap(key);
435 115627904 Lock(target);
436 120172608 hashmaps_[target].Insert(key, value);
437 113283968 Unlock(target);
438 121552832 }
439
440 57915232 void Erase(const Key &key) {
441 57915232 uint8_t target = SelectHashmap(key);
442 55068992 Lock(target);
443 58899616 hashmaps_[target].Erase(key);
444 54030368 Unlock(target);
445 59710752 }
446
447 32 void Clear() {
448
2/2
✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 32 times.
1376 for (uint8_t i = 0; i < num_hashmaps_; ++i)
449 1344 Lock(i);
450
2/2
✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 32 times.
1376 for (uint8_t i = 0; i < num_hashmaps_; ++i)
451 1344 hashmaps_[i].Clear();
452
2/2
✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 32 times.
1376 for (uint8_t i = 0; i < num_hashmaps_; ++i)
453 1344 Unlock(i);
454 32 }
455
456 320 uint8_t num_hashmaps() const { return num_hashmaps_; }
457
458 256 void GetSizes(uint32_t *sizes) {
459
2/2
✓ Branch 0 taken 10752 times.
✓ Branch 1 taken 256 times.
11008 for (uint8_t i = 0; i < num_hashmaps_; ++i) {
460 10752 Lock(i);
461 10752 sizes[i] = hashmaps_[i].size();
462 10752 Unlock(i);
463 }
464 256 }
465
466 void GetCollisionStats(uint64_t *num_collisions, uint32_t *max_collisions) {
467 for (uint8_t i = 0; i < num_hashmaps_; ++i) {
468 Lock(i);
469 hashmaps_[i].GetCollisionStats(&num_collisions[i], &max_collisions[i]);
470 Unlock(i);
471 }
472 }
473
474 private:
475 208111712 inline uint8_t SelectHashmap(const Key &key) {
476 208111712 uint32_t hash = MurmurHash2(&key, sizeof(key), 0x37);
477 204103040 double bucket = static_cast<double>(hash)
478 204103040 * static_cast<double>(num_hashmaps_)
479 / static_cast<double>(static_cast<uint32_t>(-1));
480 204103040 return static_cast<uint32_t>(bucket) % num_hashmaps_;
481 }
482
483 204807584 inline void Lock(const uint8_t target) {
484 204807584 int retval = pthread_mutex_lock(&locks_[target]);
485
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 219539744 times.
219539744 assert(retval == 0);
486 219539744 }
487
488 199414720 inline void Unlock(const uint8_t target) {
489 199414720 int retval = pthread_mutex_unlock(&locks_[target]);
490
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 220621216 times.
220621216 assert(retval == 0);
491 220621216 }
492
493 uint8_t num_hashmaps_;
494 SmallHashDynamic<Key, Value> *hashmaps_;
495 pthread_mutex_t *locks_;
496 };
497
498
499 // initialize the static fields
500 template<class Key, class Value>
501 Prng SmallHashDynamic<Key, Value>::g_prng;
502
503 template<class Key, class Value, class Derived>
504 const double SmallHashBase<Key, Value, Derived>::kLoadFactor = 0.75;
505
506 template<class Key, class Value>
507 const double SmallHashDynamic<Key, Value>::kThresholdGrow = 0.75;
508
509 template<class Key, class Value>
510 const double SmallHashDynamic<Key, Value>::kThresholdShrink = 0.25;
511
512 #endif // CVMFS_SMALLHASH_H_
513