Vita
Public Member Functions | Public Attributes | List of all members
vita::hash_t Struct Reference

A 128bit unsigned integer used as individual's signature / hash table look-up key. More...

#include <cache_hash.h>

Public Member Functions

void clear ()
 Resets the content of the object. More...
 
void combine (hash_t h)
 Used to combine multiple hashes. More...
 
bool empty () const
 We assume that a string of 128 zero bits means empty. More...
 
 hash_t (std::uint64_t a=0, std::uint64_t b=0)
 
bool load (std::istream &)
 
bool operator!= (hash_t h) const
 Standard inequality operator for hash signature. More...
 
bool operator== (hash_t h) const
 Standard equality operator for hash signature. More...
 
bool save (std::ostream &) const
 

Public Attributes

std::uint_least64_t data [2]
 

Detailed Description

A 128bit unsigned integer used as individual's signature / hash table look-up key.

Definition at line 26 of file cache_hash.h.

Constructor & Destructor Documentation

◆ hash_t()

vita::hash_t::hash_t ( std::uint64_t  a = 0,
std::uint64_t  b = 0 
)
inlineexplicit

Definition at line 28 of file cache_hash.h.

Member Function Documentation

◆ clear()

void vita::hash_t::clear ( )
inline

Resets the content of the object.

Definition at line 31 of file cache_hash.h.

◆ combine()

void vita::hash_t::combine ( hash_t  h)
inline

Used to combine multiple hashes.

Note
In spite of its handy bit-mixing properties, XOR is not a good way to combine hashes due to its commutativity (e.g. see http://stackoverflow.com/q/5889238/3235496).

Definition at line 47 of file cache_hash.h.

◆ empty()

bool vita::hash_t::empty ( ) const
inline

We assume that a string of 128 zero bits means empty.

Definition at line 61 of file cache_hash.h.

◆ load()

bool vita::hash_t::load ( std::istream &  in)
Parameters
[in]ininput stream
Returns
true if hash_t loaded correctly
Note
If the load operation isn't successful the current hash_t isn't changed.

Definition at line 26 of file cache_hash.cc.

◆ operator!=()

bool vita::hash_t::operator!= ( hash_t  h) const
inline

Standard inequality operator for hash signature.

Definition at line 38 of file cache_hash.h.

◆ operator==()

bool vita::hash_t::operator== ( hash_t  h) const
inline

Standard equality operator for hash signature.

Definition at line 34 of file cache_hash.h.

◆ save()

bool vita::hash_t::save ( std::ostream &  out) const
Parameters
[out]outoutput stream
Returns
true if hash_t was saved correctly

Definition at line 42 of file cache_hash.cc.

Member Data Documentation

◆ data

std::uint_least64_t vita::hash_t::data[2]

Definition at line 68 of file cache_hash.h.


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