libabigail
Functions
abigail::hashing Namespace Reference

Namespace for hashing. More...

Functions

size_t combine_hashes (size_t val1, size_t val2)
 
std::size_t combine_hashes (std::size_t, std::size_t)
 Produce good hash value combining val1 and val2. This is copied from tree.c in GCC. More...
 
uint32_t fnv_hash (const std::string &str)
 Compute a stable string hash. More...
 

Detailed Description

Namespace for hashing.

Function Documentation

◆ combine_hashes()

std::size_t abigail::hashing::combine_hashes ( std::size_t  ,
std::size_t   
)

Produce good hash value combining val1 and val2. This is copied from tree.c in GCC.

◆ fnv_hash()

uint32_t fnv_hash ( const std::string &  str)

Compute a stable string hash.

std::hash has no portability or stability guarantees so is unsuitable where reproducibility is a requirement such as in XML output.

This is the 32-bit FNV-1a algorithm. The algorithm, reference code and constants are all unencumbered. It is fast and has reasonable distribution properties.

https://en.wikipedia.org/wiki/Fowler-Noll-Vo_hash_function

Parameters
strthe string to hash.
Returns
an unsigned 32 bit hash value.

Definition at line 64 of file abg-hash.cc.