MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / core_hash

Function core_hash

hash_func.h:46–75  ·  view source on GitHub ↗

NOTE: @size must be 2^N, otherwise there will be gaps in the output range */

Source from the content-addressed store, hash-verified

44
45/* NOTE: @size must be 2^N, otherwise there will be gaps in the output range */
46static inline unsigned int core_hash(const str *s1, const str *s2, const unsigned int size)
47{
48 char *p, *end;
49 register unsigned v;
50 register unsigned h;
51
52 h=0;
53
54 end=s1->s+s1->len;
55 for ( p=s1->s ; p<=(end-4) ; p+=4 ){
56 v=(*p<<24)+(p[1]<<16)+(p[2]<<8)+p[3];
57 ch_h_inc;
58 }
59 v=0;
60 for (; p<end ; p++){ v<<=8; v+=*p;}
61 ch_h_inc;
62
63 if (s2) {
64 end=s2->s+s2->len;
65 for (p=s2->s; p<=(end-4); p+=4){
66 v=(*p<<24)+(p[1]<<16)+(p[2]<<8)+p[3];
67 ch_h_inc;
68 }
69 v=0;
70 for (; p<end ; p++){ v<<=8; v+=*p;}
71 ch_h_inc;
72 }
73 h=((h)+(h>>11))+((h>>13)+(h>>23));
74 return size?((h)&(size-1)):h;
75}
76
77
78static inline unsigned int core_case_hash( str *s1, str *s2, unsigned int size)

Callers 15

set_sl_branchFunction · 0.85
address_hashFunction · 0.85
send_publishFunction · 0.85
insert_htableFunction · 0.85
get_record_coordinatesFunction · 0.85
get_record_idFunction · 0.85
is_dialogFunction · 0.85
update_contactFunction · 0.85
send_subscribeFunction · 0.85
get_dynamic_lockFunction · 0.85
release_dynamic_lockFunction · 0.85
strings_share_lockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected