P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::Util::Hasher< T * > Struct Template Reference

#include <hash.h>

Public Member Functions

size_t operator() (T *val) const
 

Detailed Description

template<typename T>
struct P4::Util::Hasher< T * >

In general, pointers are bad hashes: their low 2-3 bits are zero, likewise for the upper bits depending on the ABI. Also, the middle bits might not have enough entropy as addresses come from some common pool. To solve this problem we just use a single iteration of hash_avalanche to improve mixing (see Detail::IntegerHasher).