Displaying CPU registers

This commit is contained in:
Anonymus Raccoon
2020-02-16 22:19:13 +01:00
parent 38b65b595c
commit 80d9832fbd
6 changed files with 210 additions and 4 deletions
+37
View File
@@ -0,0 +1,37 @@
//
// Created by anonymus-raccoon on 2/16/20.
//
#ifndef COMSQUARE_UTILITY_HPP
#define COMSQUARE_UTILITY_HPP
#include <string>
#include <ios>
#include <sstream>
#include "../Models/Int24.hpp"
namespace ComSquare::Utility
{
std::string to_hex(uint8_t i)
{
char buf[5];
sprintf(buf, "0x%02X", i);
return buf;
}
std::string to_hex(uint16_t i)
{
char buf[7];
sprintf(buf, "0x%04X", i);
return buf;
}
std::string to_hex(uint24_t i)
{
char buf[9];
sprintf(buf, "0x%06X", i);
return buf;
}
}
#endif //COMSQUARE_UTILITY_HPP