LAL  7.5.0.1-b72065a
LALCityHash.c File Reference

Prototypes

static UINT8 Uint128Low64 (const UINT16 *x)
 
static UINT8 Uint128High64 (const UINT16 *x)
 
static UINT8 Hash128to64 (const UINT16 *x)
 Hash 128 input bits down to 64 bits of output. More...
 
static UINT8 UNALIGNED_LOAD64 (const char *p)
 
static UINT4 UNALIGNED_LOAD32 (const char *p)
 
static UINT8 Fetch64 (const char *p)
 
static UINT4 Fetch32 (const char *p)
 
static UINT4 fmix (UINT4 h)
 
static UINT4 Rotate32 (UINT4 val, int shift)
 
static UINT4 Mur (UINT4 a, UINT4 h)
 
static UINT4 Hash32Len13to24 (const char *s, size_t len)
 
static UINT4 Hash32Len0to4 (const char *s, size_t len)
 
static UINT4 Hash32Len5to12 (const char *s, size_t len)
 
UINT4 XLALCityHash32 (const char *s, size_t len)
 Hash function for a byte array. More...
 
static UINT8 Rotate (UINT8 val, int shift)
 
static UINT8 ShiftMix (UINT8 val)
 
static UINT8 HashLen16 (UINT8 u, UINT8 v)
 
static UINT8 HashLen16mul (UINT8 u, UINT8 v, UINT8 mul)
 
static UINT8 HashLen0to16 (const char *s, size_t len)
 
static UINT8 HashLen17to32 (const char *s, size_t len)
 
static UINT16 WeakHashLen32WithSeeds_5 (UINT8 w, UINT8 x, UINT8 y, UINT8 z, UINT8 a, UINT8 b)
 
static UINT16 WeakHashLen32WithSeeds (const char *s, UINT8 a, UINT8 b)
 
static UINT8 HashLen33to64 (const char *s, size_t len)
 
UINT8 XLALCityHash64 (const char *s, size_t len)
 Hash function for a byte array. More...
 
UINT8 XLALCityHash64WithSeed (const char *s, size_t len, UINT8 seed)
 Hash function for a byte array. More...
 
UINT8 XLALCityHash64WithSeeds (const char *s, size_t len, UINT8 seed0, UINT8 seed1)
 Hash function for a byte array. More...
 

Go to the source code of this file.

Data Structures

struct  UINT16
 

Macros

#define UINT4_in_expected_order(x)   (x)
 
#define UINT8_in_expected_order(x)   (x)
 
#define LIKELY(x)   (x)
 
#define SWAP(a, b)   {a^=b; b^=a; a^=b;}
 
#define PERMUTE3(a, b, c)   do { SWAP(a, b); SWAP(a, c); } while (0)
 

Variables

static const UINT8 k0 = 0xc3a5c85c97cb3127ULL
 
static const UINT8 k1 = 0xb492b66fbe98f273ULL
 
static const UINT8 k2 = 0x9ae16a3b2f90404fULL
 
static const UINT4 c1 = 0xcc9e2d51
 
static const UINT4 c2 = 0x1b873593
 

Macro Definition Documentation

◆ UINT4_in_expected_order

#define UINT4_in_expected_order (   x)    (x)

Definition at line 120 of file LALCityHash.c.

◆ UINT8_in_expected_order

#define UINT8_in_expected_order (   x)    (x)

Definition at line 121 of file LALCityHash.c.

◆ LIKELY

#define LIKELY (   x)    (x)

Definition at line 128 of file LALCityHash.c.

◆ SWAP

#define SWAP (   a,
 
)    {a^=b; b^=a; a^=b;}

Definition at line 165 of file LALCityHash.c.

◆ PERMUTE3

#define PERMUTE3 (   a,
  b,
 
)    do { SWAP(a, b); SWAP(a, c); } while (0)

Definition at line 168 of file LALCityHash.c.

Function Documentation

◆ Uint128Low64()

static UINT8 Uint128Low64 ( const UINT16 x)
inlinestatic

Definition at line 41 of file LALCityHash.c.

◆ Uint128High64()

static UINT8 Uint128High64 ( const UINT16 x)
inlinestatic

Definition at line 42 of file LALCityHash.c.

◆ Hash128to64()

static UINT8 Hash128to64 ( const UINT16 x)
inlinestatic

Hash 128 input bits down to 64 bits of output.

This is intended to be a reasonably good hash function.

Definition at line 47 of file LALCityHash.c.

◆ UNALIGNED_LOAD64()

static UINT8 UNALIGNED_LOAD64 ( const char *  p)
static

Definition at line 58 of file LALCityHash.c.

◆ UNALIGNED_LOAD32()

static UINT4 UNALIGNED_LOAD32 ( const char *  p)
static

Definition at line 64 of file LALCityHash.c.

◆ Fetch64()

static UINT8 Fetch64 ( const char *  p)
static

Definition at line 132 of file LALCityHash.c.

◆ Fetch32()

static UINT4 Fetch32 ( const char *  p)
static

Definition at line 136 of file LALCityHash.c.

◆ fmix()

static UINT4 fmix ( UINT4  h)
static

Definition at line 150 of file LALCityHash.c.

◆ Rotate32()

static UINT4 Rotate32 ( UINT4  val,
int  shift 
)
static

Definition at line 160 of file LALCityHash.c.

◆ Mur()

static UINT4 Mur ( UINT4  a,
UINT4  h 
)
static

Definition at line 170 of file LALCityHash.c.

◆ Hash32Len13to24()

static UINT4 Hash32Len13to24 ( const char *  s,
size_t  len 
)
static

Definition at line 180 of file LALCityHash.c.

◆ Hash32Len0to4()

static UINT4 Hash32Len0to4 ( const char *  s,
size_t  len 
)
static

Definition at line 192 of file LALCityHash.c.

◆ Hash32Len5to12()

static UINT4 Hash32Len5to12 ( const char *  s,
size_t  len 
)
static

Definition at line 203 of file LALCityHash.c.

◆ Rotate()

static UINT8 Rotate ( UINT8  val,
int  shift 
)
static

Definition at line 282 of file LALCityHash.c.

◆ ShiftMix()

static UINT8 ShiftMix ( UINT8  val)
static

Definition at line 287 of file LALCityHash.c.

◆ HashLen16()

static UINT8 HashLen16 ( UINT8  u,
UINT8  v 
)
static

Definition at line 291 of file LALCityHash.c.

◆ HashLen16mul()

static UINT8 HashLen16mul ( UINT8  u,
UINT8  v,
UINT8  mul 
)
static

Definition at line 296 of file LALCityHash.c.

◆ HashLen0to16()

static UINT8 HashLen0to16 ( const char *  s,
size_t  len 
)
static

Definition at line 306 of file LALCityHash.c.

◆ HashLen17to32()

static UINT8 HashLen17to32 ( const char *  s,
size_t  len 
)
static

Definition at line 333 of file LALCityHash.c.

◆ WeakHashLen32WithSeeds_5()

static UINT16 WeakHashLen32WithSeeds_5 ( UINT8  w,
UINT8  x,
UINT8  y,
UINT8  z,
UINT8  a,
UINT8  b 
)
static

Definition at line 345 of file LALCityHash.c.

◆ WeakHashLen32WithSeeds()

static UINT16 WeakHashLen32WithSeeds ( const char *  s,
UINT8  a,
UINT8  b 
)
static

Definition at line 358 of file LALCityHash.c.

◆ HashLen33to64()

static UINT8 HashLen33to64 ( const char *  s,
size_t  len 
)
static

Definition at line 368 of file LALCityHash.c.

Variable Documentation

◆ k0

const UINT8 k0 = 0xc3a5c85c97cb3127ULL
static

Definition at line 141 of file LALCityHash.c.

◆ k1

const UINT8 k1 = 0xb492b66fbe98f273ULL
static

Definition at line 142 of file LALCityHash.c.

◆ k2

const UINT8 k2 = 0x9ae16a3b2f90404fULL
static

Definition at line 143 of file LALCityHash.c.

◆ c1

const UINT4 c1 = 0xcc9e2d51
static

Definition at line 146 of file LALCityHash.c.

◆ c2

const UINT4 c2 = 0x1b873593
static

Definition at line 147 of file LALCityHash.c.