#pragma once #include #include template static uint64_t deserlSimpleType(ByteSpan bytes) { if (bytes.size < sizeof(Type)) { throw int(1); } Type value{}; for (size_t i = 0; i < sizeof(Type); i++) { value |= Type(bytes[i]) << (i*8); } return value; } static uint64_t deserlTS(ByteSpan ts_bytes) { return deserlSimpleType(ts_bytes); } template static void serlSimpleType(std::vector& bytes, const Type& value) { for (size_t i = 0; i < sizeof(Type); i++) { bytes.push_back(uint8_t(value >> (i*8) & 0xff)); } }