#include "byteorder.h" #include std::vector endian::to_little(uint16_t value) { std::vector result(sizeof(uint16_t)); *(reinterpret_cast(result.data())) = boost::endian::native_to_little(value); return result; } uint16_t endian::from_little16(const std::vector& value) { return boost::endian::little_to_native(*(reinterpret_cast(value.data()))); } std::vector endian::to_little(uint32_t value) { std::vector result(sizeof(uint32_t)); *(reinterpret_cast(result.data())) = boost::endian::native_to_little(value); return result; } uint32_t endian::from_little32(const std::vector& value) { return boost::endian::little_to_native(*(reinterpret_cast(value.data()))); } std::vector endian::to_little(uint64_t value) { std::vector result(sizeof(uint64_t)); *(reinterpret_cast(result.data())) = boost::endian::native_to_little(value); return result; } uint64_t endian::from_little64(const std::vector& value) { return boost::endian::little_to_native(*(reinterpret_cast(value.data()))); }