This commit is contained in:
Erik Frojdh
2019-05-16 15:18:14 +02:00
9 changed files with 85 additions and 73 deletions

View File

@ -35,9 +35,9 @@ std::string IpAddr::str() const {
}
std::string IpAddr::hex() const {
std::ostringstream ss;
ss << std::hex << std::setfill('0') << std::setw(2);
for (int i = 0; i != 4; ++i) {
ss << ((addr_ >> i * 8) & 0xFF);
ss << std::hex << std::setfill('0') << std::setw(2)
<< ((addr_ >> i * 8) & 0xFF);
}
return ss.str();
}