Add hex utility functions and refactor usage in editors

This commit is contained in:
scawful
2025-01-22 13:28:21 -05:00
parent 62e6157864
commit 50c9223a53
17 changed files with 174 additions and 134 deletions

20
src/util/hex.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef YAZE_UTIL_HEX_H
#define YAZE_UTIL_HEX_H
#include <cstdint>
namespace yaze {
namespace util {
struct HexStringParams {
enum class Prefix { kNone, kDollar, kHash, k0x } prefix = Prefix::kDollar;
bool uppercase = true;
};
std::string HexByte(uint8_t byte, HexStringParams params = {});
std::string HexWord(uint16_t word, HexStringParams params = {});
std::string HexLong(uint32_t dword, HexStringParams params = {});
std::string HexLongLong(uint64_t qword, HexStringParams params = {});
} // namespace util
} // namespace yaze