MXS-1810: Add C++ hex conversion functions
Added mxs::to_hex for uint8_t types and uint8_t containers.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user