Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vectorhash.cpp File Reference
#include <iostream>
#include <iomanip>
#include <stdint.h>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstdlib>
Include dependency graph for vectorhash.cpp:

Macros

#define _POSIX_MAPPED_FILES   0
 
#define ROTL32(x, y)   rotl32(x,y)
 
#define VEC(X)   for( size_t j=0; j < vh_nint; j++ ) { X; }
 
#define VEC(X)   for( size_t j=0; j < vh_nint; j++ ) { X; }
 

Functions

uint32_t rotl32 (uint32_t x, int r)
 
void posix_memalign_free (void *p)
 
uint32_t getblock32 (uint32_t p)
 
uint32_t fmix32 (uint32_t h0, uint32_t h1=0xd86b048b)
 
void pad_buffer (const char *src, char *buf, size_t len)
 
void VectorHashFold (uint32_t *res, uint32_t *z[], size_t nbits)
 
static void VectorHashFinalize (size_t len, uint32_t *h1, uint32_t *h2, uint32_t *h3, uint32_t *h4, void *out)
 
static void stateinit (uint32_t st[], uint32_t &seed)
 
void VectorHashBody (const uint32_t *data, uint32_t h1[], uint32_t h2[], uint32_t h3[], uint32_t h4[])
 
void VectorHash (const void *key, size_t len, uint32_t seed, void *out)
 
string VHstream (FILE *io)
 
string VHstring (const string &s)
 

Variables

static const size_t vh_hash_width = 128
 
static const size_t vh_hwreg_width = 512
 
static const size_t vh_virtreg_width = ( 2*vh_hash_width > vh_hwreg_width ) ? 2*vh_hash_width : vh_hwreg_width
 
static const size_t vh_nstate = vh_hash_width/32
 
static const size_t vh_nint = vh_virtreg_width/32
 
static const size_t blocksize = 4*vh_nint*sizeof(uint32_t)
 

Macro Definition Documentation

#define _POSIX_MAPPED_FILES   0
#define ROTL32 (   x,
 
)    rotl32(x,y)

Referenced by fmix32(), and VectorHashBody().

#define VEC (   X)    for( size_t j=0; j < vh_nint; j++ ) { X; }
#define VEC (   X)    for( size_t j=0; j < vh_nint; j++ ) { X; }

Function Documentation

uint32_t fmix32 ( uint32_t  h0,
uint32_t  h1 = 0xd86b048b 
)
inline

References ROTL32.

Referenced by stateinit(), and VectorHashFinalize().

uint32_t getblock32 ( uint32_t  p)
inline

Referenced by VectorHashBody().

void pad_buffer ( const char *  src,
char *  buf,
size_t  len 
)
inline

References blocksize.

Referenced by VectorHash().

void posix_memalign_free ( void *  p)
inline

Referenced by VHstream().

uint32_t rotl32 ( uint32_t  x,
int  r 
)
inline
static void stateinit ( uint32_t  st[],
uint32_t &  seed 
)
static

References fmix32(), and vh_nint.

Referenced by VectorHash().

Here is the call graph for this function:

void VectorHash ( const void *  key,
size_t  len,
uint32_t  seed,
void *  out 
)

References blocksize, pad_buffer(), stateinit(), VectorHashBody(), VectorHashFinalize(), and vh_nint.

Referenced by VHstream(), and VHstring().

Here is the call graph for this function:

void VectorHashBody ( const uint32_t *  data,
uint32_t  h1[],
uint32_t  h2[],
uint32_t  h3[],
uint32_t  h4[] 
)
inline

References getblock32(), ROTL32, VEC, and vh_nint.

Referenced by VectorHash().

Here is the call graph for this function:

static void VectorHashFinalize ( size_t  len,
uint32_t *  h1,
uint32_t *  h2,
uint32_t *  h3,
uint32_t *  h4,
void *  out 
)
static

References fmix32(), VEC, VectorHashFold(), vh_hash_width, vh_nint, and vh_nstate.

Referenced by VectorHash().

Here is the call graph for this function:

void VectorHashFold ( uint32_t *  res,
uint32_t *  z[],
size_t  nbits 
)
inline

References vh_virtreg_width.

Referenced by VectorHashFinalize().

string VHstream ( FILE *  io)

References NULL, posix_memalign_free(), VectorHash(), vh_hwreg_width, and vh_nstate.

Referenced by check_data(), and main().

Here is the call graph for this function:

string VHstring ( const string &  s)

References VectorHash(), and vh_nstate.

Here is the call graph for this function:

Variable Documentation

const size_t blocksize = 4*vh_nint*sizeof(uint32_t)
static

Referenced by pad_buffer(), and VectorHash().

const size_t vh_hash_width = 128
static

Referenced by VectorHashFinalize().

const size_t vh_hwreg_width = 512
static

Referenced by VHstream().

const size_t vh_nint = vh_virtreg_width/32
static
const size_t vh_nstate = vh_hash_width/32
static
const size_t vh_virtreg_width = ( 2*vh_hash_width > vh_hwreg_width ) ? 2*vh_hash_width : vh_hwreg_width
static

Referenced by VectorHashFold().