Fixed width hex output
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
namespace VariadicMachine {
|
||||
@@ -135,8 +136,13 @@ private:
|
||||
std::cout << std::bitset<sizeof(int) * 8>(memory[currentPosition]);
|
||||
return;
|
||||
|
||||
// Ugh hate this, I really should use C++23
|
||||
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;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user