Do some random black magic to strings to get a relatively unique number for them.
| 972 | |
| 973 | // Do some random black magic to strings to get a relatively unique number for them. |
| 974 | static 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 | |
| 987 | void CStatistics::AddKnownClient(CUpDownClient *pClient) |
| 988 | { |
no test coverage detected