XLE  v0.02.0
Classes | Static Public Attributes | List of all members
Utility::ConstHash64< S0, S1, S2, S3 > Struct Template Reference

Generate a hash value at compile time More...

#include <MemoryUtils.h>

Classes

struct  Calc
 

Static Public Attributes

static const uint64 Seed = 0xE49B0E3F5C27F17Eull
 
static const uint64 Value = Calc<S3, Calc<S2, Calc<S1, Calc<S0, Seed>::Value>::Value>::Value>::Value
 

Detailed Description

template<unsigned S0, unsigned S1 = 0, unsigned S2 = 0, unsigned S3 = 0>
struct Utility::ConstHash64< S0, S1, S2, S3 >

Generate a hash value at compile time

Generate a simple hash value at compile time, from a set of 4-character chars.

The hash algorithm is very simple, and unique. It will produce very different hash values compared to the Hash64 function. There may be some value to attempting to make it match the "Hash64" function. However, that would require a lot more work... The current implementation is more or less the simpliest possible implementation.

Usage:

static const uint64 HashValue = ConstHash64<'Skel', 'eton'>::Value

Note that a better implementation would be possible with C++11... But currently we're still supporting Visual Studio 2010, which doesn't have an implementation of constexpr.


The documentation for this struct was generated from the following file: