You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
635 B
25 lines
635 B
/* PlipUtility.cpp |
|
* |
|
* Miscellaneous helper functions. |
|
*/ |
|
|
|
#include <iomanip> |
|
#include <sstream> |
|
|
|
#include "PlipUtility.h" |
|
|
|
namespace Plip { |
|
std::string PlipUtility::DumpValue(const std::string &label, uintmax_t value, int precision) { |
|
std::stringstream dump; |
|
dump << '\t' << label << ": " << FormatHex(value, precision); |
|
return dump.str(); |
|
} |
|
|
|
std::string PlipUtility::FormatHex(uintmax_t value, int precision) { |
|
std::stringstream fmt; |
|
fmt << "0x" << std::uppercase << std::setfill('0') << std::setw(precision) |
|
<< std::hex << value; |
|
|
|
return fmt.str(); |
|
} |
|
}
|
|
|