blob: 25b10e6bf1e6c0240ab648aa58867c0202ad962a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#include <utility>
namespace NFlatHash {
struct TSimpleExpander {
static constexpr bool NeedGrow(size_t size, size_t buckets) noexcept {
return size >= buckets / 2;
}
static constexpr bool WillNeedGrow(size_t size, size_t buckets) noexcept {
return NeedGrow(size + 1, buckets);
}
static constexpr size_t EvalNewSize(size_t buckets) noexcept {
return buckets * 2;
}
static constexpr size_t SuitableSize(size_t size) noexcept {
return size * 2 + 1;
}
};
} // namespace NFlatHash
|