Skip to content

Commit

Permalink
Allow enum types to be used as frozen keys
Browse files Browse the repository at this point in the history
Signed-off-by: IAmTrial <[email protected]>
  • Loading branch information
IAmTrial authored and serge-sans-paille-qb committed Jul 7, 2018
1 parent d0a9d3f commit 2df60da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/frozen/bits/elsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace frozen {

template <class T> struct elsa {
static_assert(std::is_integral<T>::value,
static_assert(std::is_integral<T>::value || std::is_enum<T>::value,
"only supports integral types, specialize for other types");

constexpr std::size_t operator()(T const &value, std::size_t seed) const {
std::size_t key = seed ^ value;
std::size_t key = seed ^ static_cast<std::size_t>(value);
key = (~key) + (key << 21); // key = (key << 21) - key - 1;
key = key ^ (key >> 24);
key = (key + (key << 3)) + (key << 8); // key * 265
Expand Down

0 comments on commit 2df60da

Please sign in to comment.