diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-16 12:48:44 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-16 12:48:44 +0100 |
commit | c9cb051fae190acfc36813e4a23759fb9b9c3df3 (patch) | |
tree | fcd8c93cd5dc2a3272eac253b0291611e16ea13f /minicc.cpp | |
parent | 300219dc8519720a36525c7b40c6a327580fe0bd (diff) |
Implement hierarchical evaluation (WIP)
Diffstat (limited to 'minicc.cpp')
-rw-r--r-- | minicc.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -4,6 +4,7 @@ #include "minicc.h" #include <boost/algorithm/string.hpp> +#include <boost/endian/conversion.hpp> #include <algorithm> #include <cctype> @@ -65,3 +66,15 @@ std::string demangle(const std::type_info& type) return boost::core::demangle(type.name()); } +std::vector<uint8_t> to_little_endian(uint32_t value) +{ + std::vector<uint8_t> result(size_t(4)); + *(reinterpret_cast<uint32_t*>(result.data())) = boost::endian::native_to_little(value); + return result; +} + +uint32_t from_little_endian(const std::vector<uint8_t>& value) +{ + return boost::endian::little_to_native(*(reinterpret_cast<const uint32_t*>(value.data()))); +} + |