MCPcopy Create free account
hub / github.com/cppla/ServerStatus / MakeHashArray

Method MakeHashArray

server/src/netban.cpp:38–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38int CNetBan::CNetHash::MakeHashArray(const NETADDR *pAddr, CNetHash aHash[17])
39{
40 int Length = pAddr->type==NETTYPE_IPV4 ? 4 : 16;
41 aHash[0].m_Hash = 0;
42 aHash[0].m_HashIndex = 0;
43 for(int i = 1, Sum = 0; i <= Length; ++i)
44 {
45 Sum += pAddr->ip[i-1];
46 aHash[i].m_Hash = Sum&0xFF;
47 aHash[i].m_HashIndex = i%Length;
48 }
49 return Length;
50}
51
52
53template<class T, int HashCount>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected