1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00

Adds padding for all integer types.

This commit is contained in:
Thomas Harte 2020-03-30 00:31:25 -04:00
parent 95c68c76e1
commit 6805acd74f

View File

@ -9,6 +9,7 @@
#include "Struct.hpp" #include "Struct.hpp"
#include <algorithm> #include <algorithm>
#include <iomanip>
#include <sstream> #include <sstream>
// MARK: - Setters // MARK: - Setters
@ -150,7 +151,7 @@ std::string Reflection::Struct::description() const {
} }
// Output Ints of all sizes as hex. // Output Ints of all sizes as hex.
#define OutputIntC(int_type, cast_type) if(*type == typeid(int_type)) { stream << std::hex << cast_type(::Reflection::get<int_type>(*this, key)); continue; } #define OutputIntC(int_type, cast_type) if(*type == typeid(int_type)) { stream << std::setfill('0') << std::setw(sizeof(int_type)*2) << std::hex << cast_type(::Reflection::get<int_type>(*this, key)); continue; }
#define OutputInt(int_type) OutputIntC(int_type, int_type) #define OutputInt(int_type) OutputIntC(int_type, int_type)
OutputIntC(int8_t, int16_t); OutputIntC(int8_t, int16_t);
OutputIntC(uint8_t, uint16_t); OutputIntC(uint8_t, uint16_t);