17 #ifndef NURIA_ESSENTIALS_HPP
18 #define NURIA_ESSENTIALS_HPP
20 #include "core_global.hpp"
26 constexpr uint32_t jenkinsOne (uint32_t hash,
const char *key,
int len) {
29 : jenkinsOne ((hash + *key + ((hash + *key) << 10)) ^
30 ((hash + *key + ((hash + *key) << 10)) >> 6),
44 constexpr uint32_t jenkinsHash (
const char *key,
size_t len) {
45 return ((jenkinsOne (0, key, len) + (jenkinsOne (0, key, len) << 3)) ^
46 ((jenkinsOne (0, key, len) + (jenkinsOne (0, key, len) << 3)) >> 11)) +
47 (((jenkinsOne (0, key, len) + (jenkinsOne (0, key, len) << 3)) ^
48 ((jenkinsOne (0, key, len) + (jenkinsOne (0, key, len) << 3)) >> 11)) << 15);
62 #define NURIA_DECLARE_METATYPE(...) \
65 struct QMetaTypeId< __VA_ARGS__ > \
67 enum { Defined = 1 }; \
68 static int qt_metatype_id() \
70 static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
71 if (const int id = metatype_id.loadAcquire()) \
73 const int newId = qRegisterMetaType< __VA_ARGS__ >(#__VA_ARGS__, \
74 reinterpret_cast< __VA_ARGS__ *>(quintptr(-1))); \
75 metatype_id.storeRelease(newId); \
81 #endif // NURIA_ESSENTIALS_HPP
Definition: abstractsessionmanager.hpp:24