Skip to content

Commit

Permalink
Use inline constexpr for PRIMES and MOD_PRIME arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Tessil committed Sep 22, 2024
1 parent fd95fb4 commit 799f436
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions include/tsl/hopscotch_growth_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ namespace detail {
#define TSL_HH_NB_PRIMES 23
#endif

static constexpr const std::array<std::size_t, TSL_HH_NB_PRIMES> PRIMES = {{
inline constexpr std::array<std::size_t, TSL_HH_NB_PRIMES> PRIMES = {{
1u,
5u,
17u,
Expand Down Expand Up @@ -308,8 +308,7 @@ static constexpr std::size_t mod(std::size_t hash) {
// MOD_PRIME[iprime](hash) returns hash % PRIMES[iprime]. This table allows for
// faster modulo as the compiler can optimize the modulo code better with a
// constant known at the compilation.
static constexpr const std::array<std::size_t (*)(std::size_t),
TSL_HH_NB_PRIMES>
inline constexpr std::array<std::size_t (*)(std::size_t), TSL_HH_NB_PRIMES>
MOD_PRIME = {{
&mod<0>, &mod<1>, &mod<2>, &mod<3>, &mod<4>, &mod<5>,
&mod<6>, &mod<7>, &mod<8>, &mod<9>, &mod<10>, &mod<11>,
Expand Down

0 comments on commit 799f436

Please sign in to comment.