84 *it =
static_cast<uint8_t
>(
value);
88inline void read(uint8_t
const*& it, uint16_t&
value)
90 value = ntohs(*
reinterpret_cast<uint16_t const*
>(it));
96 *
reinterpret_cast<uint16_t*
>(it) = htons(
value);
102 value = ntohl(*
reinterpret_cast<uint32_t const*
>(it));
108 *
reinterpret_cast<uint32_t*
>(it) = htonl(
value);
114 value = ntohll(*
reinterpret_cast<uint64_t const*
>(it));
120 *
reinterpret_cast<uint64_t*
>(it) = htonll(
value);
125inline void read(uint8_t
const*& it,
unsigned long&
value)
127 value = ntohll(*
reinterpret_cast<unsigned long const*
>(it));
131inline void write(uint8_t*& it,
unsigned long value)
133 *
reinterpret_cast<unsigned long*
>(it) = htonll(
value);
148 auto hi =
static_cast<uint64_t
>(
value >> 64);
149 auto lo =
static_cast<uint64_t
>(
value);
158 const auto* ptr = &
buf[0];
165 uint8_t* ptr = &*
buf.end() -
sizeof(
value);
172 std::array<uint8_t,
sizeof(
value)>
buf;
173 is.read(
reinterpret_cast<char*
>(
buf.data()),
sizeof(
value));
174 uint8_t
const* ptr = &
buf[0];
180 std::array<uint8_t,
sizeof(
value)>
buf;
181 uint8_t* ptr = &
buf[0];
183 os.write(
reinterpret_cast<char*
>(
buf.data()),
sizeof(
value));
249 buf.resize(
buf.size() + N);
250 auto* ptr = &*
buf.end() - N;
264 for (
size_t i = 0;
i < N; ++
i) {
273 for (
size_t i = 0;
i < N; ++
i) {
285 for (
size_t i = 0;
i < size; ++
i) {
295 for (
size_t i = 0;
i <
value.size(); ++
i) {
304 std::vector<uint8_t>
buf;
355 for (
size_t i = 0;
i < size; ++
i) {
420 const auto* ptr =
reinterpret_cast<uint8_t const*
>(&
buffer[
offset]);
428 std::vector<uint8_t>
buf;
451 auto heap_buf_size_aligned = (heap_buf.size() + 63) & ~
static_cast<size_t>(63);
453 auto* ptr =
reinterpret_cast<uint8_t*
>(aligned_alloc(64, heap_buf_size_aligned));
454 std::copy(heap_buf.begin(), heap_buf.end(), ptr);
460 const size_t num_elements =
buffer.size() /
sizeof(T);
462 for (
size_t i = 0; i < num_elements; ++i) {
463 elements.push_back(from_buffer<T>(
buffer, i *
sizeof(T)));
472 std::vector<uint8_t>
buf;
476 for (
auto e :
value) {
uint8_t buffer[RANDOM_BUFFER_SIZE]
void msgpack_apply(const auto &func, auto &... args)
Helper method for better error reporting. Clang does not give the best errors for lambdas.
void _write_msgpack_field(auto &it, const auto &field)
Helper method for better error reporting. Clang does not give the best errors for "auto....
void _read_msgpack_field(auto &it, auto &field)
Helper method for better error reporting. Clang does not give the best errors for "auto....
void read(auto &it, msgpack_concepts::HasMsgPack auto &obj)
Automatically derived read for any object that defines .msgpack() (implicitly defined by MSGPACK_FIEL...
void write(auto &buf, const msgpack_concepts::HasMsgPack auto &obj)
Automatically derived write for any object that defines .msgpack() (implicitly defined by MSGPACK_FIE...
void read(auto &buf, std::integral auto &value)
void write(auto &buf, std::integral auto value)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
uint8_t const * in_buf128
T from_buffer(B const &buffer, size_t offset=0)
std::vector< uint8_t > to_buffer(T const &value)
uint8_t * to_heap_buffer(T const &value)
uint8_t const * in_str_buf
std::vector< T > many_from_buffer(std::vector< uint8_t > const &buffer)
unsigned __int128 uint128_t