Cogs.Foundation
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
HashFunctions.h File Reference
#include "FoundationBase.h"
#include <string_view>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  Cogs
 Main Cogs namespace.
 
namespace  Cogs::Details
 

Functions

COGSFOUNDATION_API size_t Cogs::murmur2 (const void *bytes, const size_t length) noexcept
 Implementation of the MurmurHash2 algorithm.
 
constexpr size_t Cogs::fnv1a (uint8_t data, size_t hashValue) noexcept
 Hashes a single byte using the fnv1a algorithm.
 
constexpr size_t Cogs::fnv1a (const void *bytes, size_t length, size_t hashValue=Details::FNV_offset_basis) noexcept
 Implementation of the FNV-1a algorithm for a block of memory.
 
constexpr size_t Cogs::hash () noexcept
 Simple getter function that returns the initial value for fnv1a hashing.
 
template<typename T , typename std::enable_if< std::is_integral< T >::value||std::is_enum< T >::value||std::is_floating_point< T >::value, int >::type * = nullptr>
constexpr size_t Cogs::hash (T data, size_t hashValue=hash()) noexcept
 Hash function for integer and floating point types. (And enums.)
 
constexpr size_t Cogs::hash (const char *str, size_t hashValue=hash()) noexcept
 Hash function for hashing Null terminated C character strings.
 
COGSFOUNDATION_API size_t Cogs::hashLowercase (std::string_view str, size_t hashValue=Cogs::hash()) noexcept
 Get the hash code of the string converted to lowercase.
 
constexpr size_t Cogs::hash (const void *mem, size_t size, size_t hashValue=hash()) noexcept
 Hash a non-descript block of memory.
 
constexpr size_t Cogs::hash (std::string_view str, size_t hashValue=hash()) noexcept
 Generic hash function specialization for strings (std::string, std::string_view, Cogs::StringView).
 

Variables

constexpr size_t Cogs::Details::FNV_offset_basis = (sizeof(size_t) == 8) ? static_cast<size_t>(14695981039346656037ULL) : 2166136261U
 
constexpr size_t Cogs::Details::FNV_prime = (sizeof(size_t) == 8) ? static_cast<size_t>(1099511628211ULL) : 16777619U