SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TStrHashF_DJB Class Reference

#include <hash.h>

Static Public Member Functions

static int GetPrimHashCd (const char *p)
 
static int GetSecHashCd (const char *p)
 
static int GetPrimHashCd (const TStr &s)
 
static int GetSecHashCd (const TStr &s)
 
static int GetPrimHashCd (const char *p, const ::TSize &Len)
 
static int GetSecHashCd (const char *p, const ::TSize &Len)
 

Static Private Member Functions

static unsigned int DJBHash (const char *Str, const ::TSize &Len)
 

Detailed Description

Definition at line 1172 of file hash.h.

Member Function Documentation

static unsigned int TStrHashF_DJB::DJBHash ( const char *  Str,
const ::TSize Len 
)
inlinestaticprivate

Definition at line 1174 of file hash.h.

1174  {
1175  unsigned int hash = 5381;
1176  for(unsigned int i = 0; i < Len; Str++, i++) {
1177  hash = ((hash << 5) + hash) + (*Str); }
1178  return hash;
1179  }
static int TStrHashF_DJB::GetPrimHashCd ( const char *  p)
inlinestatic

Definition at line 1181 of file hash.h.

1181  {
1182  const char *r = p; while (*r) { r++; }
1183  return (int) DJBHash((const char *) p, r - p) & 0x7fffffff; }
static unsigned int DJBHash(const char *Str, const ::TSize &Len)
Definition: hash.h:1174
static int TStrHashF_DJB::GetPrimHashCd ( const TStr s)
inlinestatic

Definition at line 1187 of file hash.h.

1187  {
1188  return GetPrimHashCd(s.CStr()); }
char * CStr()
Definition: dt.h:476
static int GetPrimHashCd(const char *p)
Definition: hash.h:1181
static int TStrHashF_DJB::GetPrimHashCd ( const char *  p,
const ::TSize Len 
)
inlinestatic

Definition at line 1191 of file hash.h.

1191  {
1192  return (int) DJBHash((const char *) p, Len) & 0x7fffffff; }
static unsigned int DJBHash(const char *Str, const ::TSize &Len)
Definition: hash.h:1174
static int TStrHashF_DJB::GetSecHashCd ( const char *  p)
inlinestatic

Definition at line 1184 of file hash.h.

1184  {
1185  const char *r = p; while (*r) { r++; }
1186  return (int) DJBHash((const char *) p, r - p) & 0x7fffffff; }
static unsigned int DJBHash(const char *Str, const ::TSize &Len)
Definition: hash.h:1174
static int TStrHashF_DJB::GetSecHashCd ( const TStr s)
inlinestatic

Definition at line 1189 of file hash.h.

1189  {
1190  return GetSecHashCd(s.CStr()); }
static int GetSecHashCd(const char *p)
Definition: hash.h:1184
char * CStr()
Definition: dt.h:476
static int TStrHashF_DJB::GetSecHashCd ( const char *  p,
const ::TSize Len 
)
inlinestatic

Definition at line 1193 of file hash.h.

1193  {
1194  return (int) DJBHash((const char *) p, Len) & 0x7fffffff; }
static unsigned int DJBHash(const char *Str, const ::TSize &Len)
Definition: hash.h:1174

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