#ifndef __rf_common_ih__ #define __rf_common_ih__ #include "rf_common.hh" namespace rfrt { static inline uint32_t update_hash (uint32_t _hash, void* _ptr, size_t _len) { char* p = static_cast(_ptr); while (_len--) { _hash += *p++; _hash += (_hash << 10); _hash ^= (_hash >> 6); } return _hash; } static inline uint32_t finish_hash (uint32_t _hash) { _hash += (_hash << 3); _hash ^= (_hash >> 11); _hash += (_hash << 15); return (_hash & (hash_size - 1)); } static inline uint32_t compute_hash (void* _ptr, size_t _len) { return finish_hash(update_hash(0, _ptr, _len)); } } #endif // __rf_common_ih__