Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
hash.h File Reference
#include "Math/math_fwd.h"
#include <Common/primitive_type.h>
#include <cstddef>
#include <concepts>
#include "Math/hash.ipp"

Go to the source code of this file.

Classes

struct  ph::math::Murmur3BitMixer32
 

Namespaces

namespace  ph
 The root for all renderer implementations.
 
namespace  ph::math
 Math functions and utilities.
 

Functions

template<typename Integer >
std::size_t ph::math::discrete_spatial_hash (Integer x, Integer y, Integer z, std::size_t hashTableSize)
 
template<typename Integer >
std::size_t ph::math::discrete_spatial_hash (Integer x, Integer y, std::size_t hashTableSize)
 
template<std::integral T>
std::size_t ph::math::discrete_spatial_hash (const TVector3< T > &point, std::size_t hashTableSize)
 
template<std::floating_point T>
std::size_t ph::math::discrete_spatial_hash (const TVector3< T > &point, const TVector3< T > &cellSize, std::size_t hashTableSize)
 
uint32 ph::math::murmur3_bit_mix_32 (uint32 v)
 MurmurHash3's bit mixer. 32-bit version.
 
uint64 ph::math::murmur3_bit_mix_64 (uint64 v)
 MurmurHash3's bit mixer. 64-bit version.
 
uint64 ph::math::murmur3_v13_bit_mix_64 (uint64 v)
 MurmurHash3's bit mixer. 64-bit version.
 
uint64 ph::math::moremur_bit_mix_64 (uint64 v)
 A MurmurHash3-style bit mixer that outperforms the original by quite some margin. 64-bit version.
 
template<typename T , typename BitMixerType = Murmur3BitMixer32>
uint32 ph::math::murmur3_32 (const T &data, uint32 seed)
 Generate 32-bit hash values using MurmurHash3. Note that there are no collisions when T has <= 32 bits (two distinct inputs will not result in the same output). In general, if there is a way to reverse a function (reversing murmur3_32() is possible), it is guaranteed there cannot be any collisions. Otherwise, it would not be possible to revert.
 
template<typename T , typename BitMixerType >
uint32 ph::math::murmur3_32 (const T *data, std::size_t dataSize, BitMixerType &&bitMixer, uint32 seed)
 Generate 32-bit hash values using MurmurHash3. This is a lower level variant of MurmurHash3 and can be useful for customizing its behavior, e.g., it can accept arbitrary BitMixerType without requiring it to be default constructible.
 
uint32 ph::math::permuted_index (uint32 i, uint32 l, uint32 p)
 Get the permuted index or value in O(1) space and O(1) time.