We were actually storing the last 6 numbers of the ip address or half of the IP address, this would make it 16 bits.
Since I read the whole number as an 8 byte unsigned long, to get the last 6 numbers I took mod 1,000,000, and then modded the result with the size of the hash table.
To convert a number into a string, use sstream:
stringstream ss;
ss << number;
string numberString = ss.str();
To convert a string into a number:
string numberString;
istringstream(numberString) >> number;
- Kon