11template <
typename T>
struct vec2;
20#pragma GCC diagnostic push
21#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
23 const uint8_t *data =
static_cast<const uint8_t *
>(key);
24 const int nblocks = int(len / 4);
27 const uint32_t c1 = 0xcc9e2d51;
28 const uint32_t c2 = 0x1b873593;
31 const uint32_t *blocks =
reinterpret_cast<const uint32_t *
>(data);
32 for (
int i = 0; i < nblocks; ++i) {
33 uint32_t k1 = blocks[i];
35 k1 = (k1 << 15) | (k1 >> 17);
39 h1 = (h1 << 13) | (h1 >> 19);
40 h1 = h1 * 5 + 0xe6546b64;
44 const uint8_t *tail = data + (nblocks * 4);
48 k1 ^= uint32_t(tail[2]) << 16;
50 k1 ^= uint32_t(tail[1]) << 8;
52 k1 ^= uint32_t(tail[0]);
54 k1 = (k1 << 15) | (k1 >> 17);
70#pragma GCC diagnostic pop
77 x = (
x ^ 61u) ^ (
x >> 16);
86static inline uint32_t
hash_pair(uint32_t a, uint32_t b,
87 uint32_t seed = 0) noexcept {
97template <
typename T>
struct Hash {
99 "fl::Hash<T> only supports POD types (integrals, floats, "
100 "etc.), you need to define your own hash.");
108 "fl::FastHash<T> only supports POD types (integrals, floats, "
109 "etc.), you need to define your own hash.");
117 if (
sizeof(T) ==
sizeof(uint8_t)) {
118 uint32_t
x =
static_cast<uint32_t
>(key.x) +
119 (
static_cast<uint32_t
>(key.y) << 8);
122 if (
sizeof(T) ==
sizeof(uint16_t)) {
123 uint32_t
x =
static_cast<uint32_t
>(key.x) +
124 (
static_cast<uint32_t
>(key.y) << 16);
127 if (
sizeof(T) ==
sizeof(uint32_t)) {
134template <
typename T>
struct Hash<T *> {
143#pragma GCC diagnostic push
144#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
147 memset(packed, 0,
sizeof(packed));
150 const void *
p = &packed[0];
153#pragma GCC diagnostic pop
161 return hasher(key.get());
165#define FASTLED_DEFINE_FAST_HASH(T) \
166 template <> struct Hash<T> { \
167 uint32_t operator()(const int &key) const noexcept { \
168 return fast_hash32(key); \
186template <>
struct Hash<
fl::Str> {
const char * data() const
#define FASTLED_DEFINE_FAST_HASH(T)
static uint32_t MurmurHash3_x86_32(const void *key, size_t len, uint32_t seed=0)
static uint32_t fast_hash32(uint32_t x) noexcept
static uint32_t hash_pair(uint32_t a, uint32_t b, uint32_t seed=0) noexcept
Implements a simple red square effect for 2D LED grids.
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
uint32_t operator()(const vec2< T > &key) const noexcept
uint32_t operator()(const T &key) const noexcept
uint32_t operator()(const T &key) const noexcept
uint32_t operator()(const T *key) const noexcept
uint32_t operator()(const vec2< T > &key) const noexcept
uint32_t operator()(const T &key) const noexcept
static constexpr bool value