| 36 | } |
| 37 | |
| 38 | int 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 | |
| 53 | template<class T, int HashCount> |
nothing calls this directly
no outgoing calls
no test coverage detected