NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
hash.hpp 文件参考

哈希函数库 更多...

hash.hpp 的引用(Include)关系图:

浏览该文件的源代码.

struct  neforce::hash< T * >
 指针类型的哈希特化 更多...
struct  neforce::hash< T, enable_if_t< is_enum_v< T > > >
 枚举类型的哈希特化 更多...
struct  neforce::murmur_hash
 MurmurHash_x64的128位哈希结果容器 更多...
struct  neforce::is_nothrow_hashable< Key, Dummy >
 判断类型是否可无异常哈希 更多...
struct  neforce::is_hash< Func, Arg, Dummy >
 判断类型是否为有效的哈希函数 更多...

函数

constexpr size_t neforce::FNV_hash (const byte_t *first, const size_t count) noexcept
 FNV-1a哈希算法
template<typename T>
constexpr size_t neforce::FNV_hash_integer (const T value) noexcept
 整数类型的FNV哈希
template<typename CharT>
constexpr size_t neforce::FNV_hash_string (const CharT *str, const size_t len) noexcept
 字符串类型的FNV哈希
constexpr size_t neforce::low_level_hash (size_t x) noexcept
 快速位混合哈希函数
template<typename T>
constexpr void neforce::hash_combine (size_t &seed, const T &value) noexcept
 混合两个哈希值
template<typename... Types>
constexpr size_t neforce::hash_combine_all (const Types &... values) noexcept
 混合多个哈希值
constexpr size_t neforce::DJB2_hash (const char *str, const size_t len) noexcept
 DJB2哈希算法
murmur_hash neforce::murmur_hash64 (const void *key, size_t len, uint32_t seed) noexcept
 MurmurHash3_x64_128算法
uint32_t neforce::murmur_hash32 (const void *key, size_t len, uint32_t seed) noexcept
 MurmurHash3_x86_32算法
constexpr uint32_t neforce::XXH32 (const void *input, size_t len, uint32_t seed=0) noexcept
 XXH32 哈希算法
constexpr uint64_t neforce::XXH64 (const void *input, size_t len, uint64_t seed=0) noexcept
 XXH64 哈希算法
uint64_t neforce::wyhash (const void *key, size_t len, uint64_t seed) noexcept
 wyhash 哈希算法
size_t neforce::city_hash64 (const void *key, size_t len) noexcept
 CityHash64 哈希算法
uint64_t neforce::XXH3_64 (const void *data, size_t len) noexcept
 XXH3_64bits 哈希算法

变量

constexpr size_t neforce::constants::FNV_OFFSET_BASIS
 FNV哈希算法的偏移基础值
constexpr size_t neforce::constants::FNV_PRIME = 1099511628211ULL
 FNV哈希算法的质数乘数
template<typename Key>
constexpr bool neforce::is_nothrow_hashable_v = is_nothrow_hashable<Key>::value
 is_nothrow_hashable的便捷变量模板
template<typename Func, typename Arg>
constexpr bool neforce::is_hash_v = is_hash<Func, Arg>::value
 is_hash的便捷变量模板

详细描述

哈希函数库

此文件提供了各种哈希算法的实现,包括FNV-1a、DJB2和MurmurHash等, 以及基本数据类型的哈希函数特化。支持编译时哈希计算和运行时高效哈希。

对基本类型的哈希特化将不展示在文档内,有需要可自行查看本文件内容。

在文件 hash.hpp 中定义.

函数说明

◆ hash_combine()

template<typename T>
void neforce::hash_combine ( size_t & seed,
const T & value )
constexprnoexcept

混合两个哈希值

模板参数
T值类型
参数
seed种子哈希值(累加器)
value要混合的值

用于组合多个字段的哈希值。

注解
该函数调用 hash<T>() 获取值的哈希,然后与种子混合

在文件 hash.hpp295 行定义.

◆ hash_combine_all()

template<typename... Types>
size_t neforce::hash_combine_all ( const Types &... values)
constexprnoexcept

混合多个哈希值

模板参数
Types值类型包
参数
values要混合的多个值
返回
组合后的哈希值

将多个值依次 hash_combine 到一个哈希值中。

在文件 hash.hpp308 行定义.