MXS-1810: Add C++ hex conversion functions

Added mxs::to_hex for uint8_t types and uint8_t containers.
This commit is contained in:
Markus Mäkelä
2018-04-18 12:25:18 +03:00
parent 640501c03a
commit 755d080161
2 changed files with 58 additions and 0 deletions

View File

@ -29,6 +29,7 @@
*/
#include <maxscale/utils.h>
#include <maxscale/utils.hh>
#include <fcntl.h>
#include <netdb.h>
@ -1136,3 +1137,16 @@ long get_processor_count()
#endif
return processors;
}
namespace maxscale
{
std::string to_hex(uint8_t value)
{
std::string out;
out += hex_lower[value >> 4];
out += hex_lower[value & 0x0F];
return out;
}
}