Refactor UppercaseHexWord function to include an optional leading parameter
This commit is contained in:
@@ -26,8 +26,12 @@ std::string UppercaseHexByte(uint8_t byte, bool leading) {
|
||||
std::string result = absl::StrFormat("%02X", byte);
|
||||
return result;
|
||||
}
|
||||
std::string UppercaseHexWord(uint16_t word) {
|
||||
std::string result = absl::StrFormat("0x%04X", word);
|
||||
std::string UppercaseHexWord(uint16_t word, bool leading) {
|
||||
if (leading) {
|
||||
std::string result = absl::StrFormat("0x%04X", word);
|
||||
return result;
|
||||
}
|
||||
std::string result = absl::StrFormat("%04X", word);
|
||||
return result;
|
||||
}
|
||||
std::string UppercaseHexLong(uint32_t dword) {
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace app {
|
||||
namespace core {
|
||||
|
||||
std::string UppercaseHexByte(uint8_t byte, bool leading = false);
|
||||
std::string UppercaseHexWord(uint16_t word);
|
||||
std::string UppercaseHexWord(uint16_t word, bool leading = false);
|
||||
std::string UppercaseHexLong(uint32_t dword);
|
||||
std::string UppercaseHexLongLong(uint64_t qword);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user