php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
PMurHash128.c File Reference
#include "PMurHash128.h"
#include "endianness.h"

Go to the source code of this file.

Macros

#define FORCE_INLINE   static inline __attribute__((always_inline))
 
#define ROTL32(x, r)
 
#define ROTL64(x, r)
 
#define BIG_CONSTANT(x)
 
#define READ_UINT64(ptr, i)
 
#define READ_UINT32(ptr, i)
 
#define doblock128x86(h1, h2, h3, h4, k1, k2, k3, k4)
 
#define dobytes128x86(cnt, h1, h2, h3, h4, k1, k2, k3, k4, n, ptr, len)
 
#define doblock128x64(h1, h2, k1, k2)
 
#define dobytes128x64(cnt, h1, h2, k1, k2, n, ptr, len)
 

Functions

FORCE_INLINE uint32_t fmix32 (uint32_t h)
 
FORCE_INLINE uint64_t fmix64 (uint64_t k)
 
void PMurHash128x86_Result (const uint32_t ph[4], const uint32_t pcarry[4], uint32_t total_length, uint32_t out[4])
 
void PMurHash128x86_Process (uint32_t ph[4], uint32_t pcarry[4], const void *const key, int len)
 
void PMurHash128x86 (const void *key, const int len, uint32_t seed, void *out)
 
void PMurHash128x64_Result (const uint64_t ph[2], const uint64_t pcarry[2], const uint32_t total_length, uint64_t out[2])
 
void PMurHash128x64_Process (uint64_t ph[2], uint64_t pcarry[2], const void *const key, int len)
 
void PMurHash128x64 (const void *key, const int len, uint32_t seed, void *out)
 

Macro Definition Documentation

◆ BIG_CONSTANT

#define BIG_CONSTANT ( x)
Value:
(x##LLU)

Definition at line 74 of file PMurHash128.c.

◆ doblock128x64

#define doblock128x64 ( h1,
h2,
k1,
k2 )
Value:
do {\
k1 *= kC1L; k1 = ROTL64(k1,31); k1 *= kC2L; h1 ^= k1;\
\
h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;\
\
k2 *= kC2L; k2 = ROTL64(k2,33); k2 *= kC1L; h2 ^= k2;\
\
h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;\
} while(0)
#define ROTL64(x, r)
Definition PMurHash128.c:73

Definition at line 446 of file PMurHash128.c.

◆ doblock128x86

#define doblock128x86 ( h1,
h2,
h3,
h4,
k1,
k2,
k3,
k4 )
Value:
do {\
k1 *= kC1; k1 = ROTL32(k1,15); k1 *= kC2; h1 ^= k1;\
\
h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;\
\
k2 *= kC2; k2 = ROTL32(k2,16); k2 *= kC3; h2 ^= k2;\
\
h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;\
\
k3 *= kC3; k3 = ROTL32(k3,17); k3 *= kC4; h3 ^= k3;\
\
h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;\
\
k4 *= kC4; k4 = ROTL32(k4,18); k4 *= kC1; h4 ^= k4;\
\
h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;\
} while(0)
#define ROTL32(s, v)
Definition hash_md.c:113

Definition at line 122 of file PMurHash128.c.

◆ dobytes128x64

#define dobytes128x64 ( cnt,
h1,
h2,
k1,
k2,
n,
ptr,
len )
Value:
do {\
unsigned __cnt = cnt;\
for(;__cnt--; len--) {\
switch(n) {\
case 0: case 1: case 2: case 3:\
case 4: case 5: case 6: case 7:\
k1 = k1>>8 | (uint64_t)*ptr++<<56;\
n++; break;\
\
case 8: case 9: case 10: case 11:\
case 12: case 13: case 14:\
k2 = k2>>8 | (uint64_t)*ptr++<<56;\
n++; break;\
\
case 15:\
k2 = k2>>8 | (uint64_t)*ptr++<<56;\
doblock128x64(h1, h2, k1, k2);\
n = 0; break;\
}\
}\
} while(0)
size_t len
Definition apprentice.c:174
zend_long n
Definition ffi.c:4979
void * ptr
Definition ffi.c:3814

Definition at line 459 of file PMurHash128.c.

◆ dobytes128x86

#define dobytes128x86 ( cnt,
h1,
h2,
h3,
h4,
k1,
k2,
k3,
k4,
n,
ptr,
len )
Value:
do {\
unsigned __cnt = cnt;\
for(;__cnt--; len--) {\
switch(n) {\
case 0: case 1: case 2: case 3:\
k1 = k1>>8 | (uint32_t)*ptr++<<24;\
++n; break;\
\
case 4: case 5: case 6: case 7:\
k2 = k2>>8 | (uint32_t)*ptr++<<24;\
++n; break;\
\
case 8: case 9: case 10: case 11:\
k3 = k3>>8 | (uint32_t)*ptr++<<24;\
++n; break;\
\
case 12: case 13: case 14:\
k4 = k4>>8 | (uint32_t)*ptr++<<24;\
++n; break;\
\
case 15:\
k4 = k4>>8 | (uint32_t)*ptr++<<24;\
doblock128x86(h1, h2, h3, h4, k1, k2, k3, k4);\
n = 0; break;\
}\
}\
} while(0)

Definition at line 143 of file PMurHash128.c.

◆ FORCE_INLINE

#define FORCE_INLINE   static inline __attribute__((always_inline))

Definition at line 70 of file PMurHash128.c.

◆ READ_UINT32

#define READ_UINT32 ( ptr,
i )
Value:
getblock32((uint32_t *)ptr,i)
NO_SANITIZE_ALIGNMENT FORCE_INLINE uint32_t getblock32(const uint32_t *const p, const int i)
Definition endianness.h:65

Definition at line 80 of file PMurHash128.c.

◆ READ_UINT64

#define READ_UINT64 ( ptr,
i )
Value:
getblock64((uint64_t *)ptr,i)
NO_SANITIZE_ALIGNMENT FORCE_INLINE uint64_t getblock64(const uint64_t *const p, const int i)
Definition endianness.h:75

Definition at line 79 of file PMurHash128.c.

◆ ROTL32

#define ROTL32 ( x,
r )
Value:
(((uint32_t)x << r) | ((uint32_t)x >> (32 - r)))

Definition at line 72 of file PMurHash128.c.

◆ ROTL64

#define ROTL64 ( x,
r )
Value:
(((uint64_t)x << r) | ((uint64_t)x >> (64 - r)))

Definition at line 73 of file PMurHash128.c.

Function Documentation

◆ fmix32()

FORCE_INLINE uint32_t fmix32 ( uint32_t h)

Definition at line 85 of file PMurHash128.c.

◆ fmix64()

FORCE_INLINE uint64_t fmix64 ( uint64_t k)

Definition at line 98 of file PMurHash128.c.

◆ PMurHash128x64()

void PMurHash128x64 ( const void * key,
const int len,
uint32_t seed,
void * out )

Definition at line 634 of file PMurHash128.c.

◆ PMurHash128x64_Process()

void PMurHash128x64_Process ( uint64_t ph[2],
uint64_t pcarry[2],
const void *const key,
int len )

Definition at line 526 of file PMurHash128.c.

◆ PMurHash128x64_Result()

void PMurHash128x64_Result ( const uint64_t ph[2],
const uint64_t pcarry[2],
const uint32_t total_length,
uint64_t out[2] )

Definition at line 483 of file PMurHash128.c.

◆ PMurHash128x86()

void PMurHash128x86 ( const void * key,
const int len,
uint32_t seed,
void * out )

Definition at line 427 of file PMurHash128.c.

◆ PMurHash128x86_Process()

void PMurHash128x86_Process ( uint32_t ph[4],
uint32_t pcarry[4],
const void *const key,
int len )

Definition at line 243 of file PMurHash128.c.

◆ PMurHash128x86_Result()

void PMurHash128x86_Result ( const uint32_t ph[4],
const uint32_t pcarry[4],
uint32_t total_length,
uint32_t out[4] )

Definition at line 173 of file PMurHash128.c.