MCPcopy Create free account
hub / github.com/amule-project/amule / GetIdFromString

Function GetIdFromString

src/Statistics.cpp:974–985  ·  view source on GitHub ↗

Do some random black magic to strings to get a relatively unique number for them.

Source from the content-addressed store, hash-verified

972
973// Do some random black magic to strings to get a relatively unique number for them.
974static uint32 GetIdFromString(const wxString& str)
975{
976 uint32 id = 0;
977 for (unsigned i = 0; i < str.Length(); ++i) {
978 unsigned old_id = id;
979 id += (uint32)str.GetChar(i);
980 id <<= 2;
981 id ^= old_id;
982 id -= old_id;
983 }
984 return (((id >> 1) + id) | 0x00000100) & 0x7fffffff;
985}
986
987void CStatistics::AddKnownClient(CUpDownClient *pClient)
988{

Callers 2

AddKnownClientMethod · 0.85
RemoveKnownClientMethod · 0.85

Calls 1

LengthMethod · 0.80

Tested by

no test coverage detected