15 template<
typename t,
size_t sz = sizeof(t)>
16 union CORELINK_EXPORT
pun
18 static_assert(std::is_arithmetic<t>::value,
"Non-numeric values are not supported");
64 template<
typename num_typ,
65 size_t sz =
sizeof(num_typ),
67 CORELINK_EXPORT
inline std::vector<uint8_t>
to_bytes(num_typ val)
76 auto bytes = std::vector<uint8_t>(std::make_move_iterator(_.bytes.begin()),
77 std::make_move_iterator(_.bytes.end()));
78 if (sys_endian != e) std::reverse(bytes.begin(), bytes.end());
92 template<
typename num_typ, endianness e = endianness::little>
93 CORELINK_EXPORT
inline num_typ
from_bytes(std::vector<uint8_t> bytes, num_typ default_val = num_typ())
102 if (e != sys_endian) std::reverse(bytes.begin(), bytes.end());
CORELINK_EXPORT std::vector< uint8_t > to_bytes(num_typ val)
Definition system.hpp:67
CORELINK_EXPORT num_typ from_bytes(std::vector< uint8_t > bytes, num_typ default_val=num_typ())
Definition system.hpp:93
CORELINK_EXPORT endianness sys_endianness()
Definition system.hpp:39
endianness
Mark the endianness of data in the memory.
Definition system.hpp:31
Definition reader_writer_lock_shim.hpp:7
t val
Definition system.hpp:19
std::array< uint8_t, sz > bytes
Definition system.hpp:20