Fixed width hex output
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace VariadicMachine {
|
namespace VariadicMachine {
|
||||||
@@ -135,8 +136,13 @@ private:
|
|||||||
std::cout << std::bitset<sizeof(int) * 8>(memory[currentPosition]);
|
std::cout << std::bitset<sizeof(int) * 8>(memory[currentPosition]);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Ugh hate this, I really should use C++23
|
||||||
case AsHex:
|
case AsHex:
|
||||||
std::cout << std::hex << memory[currentPosition] << std::dec;
|
std::cout << "0x" << std::setfill('0') << std::setw(sizeof(int))
|
||||||
|
<< std::hex << memory[currentPosition];
|
||||||
|
|
||||||
|
// Stupid reset because cout is a dumb dumb thing
|
||||||
|
std::cout << std::dec << std::setfill(' ') << std::setw(0);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user