hmbdc
simplify-high-performance-messaging-programming
Misc.h
1 #include "hmbdc/Copyright.hpp"
2 #pragma once
3 
4 #include <sstream>
5 
6 namespace hmbdc { namespace text {
7 inline
8 uint32_t
9 ipStr2Uint32(char const* ipStr) {
10  uint32_t byte1, byte2, byte3, byte4;
11  char dot;
12  std::istringstream s(ipStr);
13  s >> byte1 >> dot >> byte2 >> dot >> byte3 >> dot >> byte4 >> dot;
14  auto res = byte1;
15  res = (res << 8u) + byte2;
16  res = (res << 8u) + byte3;
17  res = (res << 8u) + byte4;
18  return res;
19 }
20 
21 }}
Definition: Base.hpp:13