From c0e416e0309aa9bdebe04ce3d1b76f1cf9e7931b Mon Sep 17 00:00:00 2001 From: cat Date: Tue, 10 Feb 2026 02:01:30 +0200 Subject: [PATCH] Fixed width hex output --- machine.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/machine.hpp b/machine.hpp index 90a8f93..3f50cbc 100644 --- a/machine.hpp +++ b/machine.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include namespace VariadicMachine { @@ -135,8 +136,13 @@ private: std::cout << std::bitset(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: