85 *it =
static_cast<uint8_t
>(
value);
89inline void read(uint8_t
const*& it, uint16_t&
value)
91 value = ntohs(*
reinterpret_cast<uint16_t const*
>(it));
97 *
reinterpret_cast<uint16_t*
>(it) = htons(
value);
103 value = ntohl(*
reinterpret_cast<uint32_t const*
>(it));
109 *
reinterpret_cast<uint32_t*
>(it) = htonl(
value);
115 value = ntohll(*
reinterpret_cast<uint64_t const*
>(it));
121 *
reinterpret_cast<uint64_t*
>(it) = htonll(
value);
126inline void read(uint8_t
const*& it,
unsigned long&
value)
128 value = ntohll(*
reinterpret_cast<unsigned long const*
>(it));
132inline void write(uint8_t*& it,
unsigned long value)
134 *
reinterpret_cast<unsigned long*
>(it) = htonll(
value);
149 auto hi =
static_cast<uint64_t
>(
value >> 64);
150 auto lo =
static_cast<uint64_t
>(
value);
159 const auto* ptr = &
buf[0];
166 uint8_t* ptr = &*
buf.end() -
sizeof(
value);
173 std::array<uint8_t,
sizeof(
value)>
buf;
174 is.read(
reinterpret_cast<char*
>(
buf.data()),
sizeof(
value));
175 uint8_t
const* ptr = &
buf[0];
181 std::array<uint8_t,
sizeof(
value)>
buf;
182 uint8_t* ptr = &
buf[0];
184 os.write(
reinterpret_cast<char*
>(
buf.data()),
sizeof(
value));
250 buf.resize(
buf.size() + N);
251 auto* ptr = &*
buf.end() - N;
265 for (
size_t i = 0;
i < N; ++
i) {
274 for (
size_t i = 0;
i < N; ++
i) {
286 for (
size_t i = 0;
i < size; ++
i) {
296 for (
size_t i = 0;
i <
value.size(); ++
i) {
305 std::vector<uint8_t>
buf;
356 for (
size_t i = 0;
i < size; ++
i) {
409 const auto* ptr =
reinterpret_cast<uint8_t const*
>(&
buffer[
offset]);
417 std::vector<uint8_t>
buf;
440 auto heap_buf_size_aligned = (heap_buf.size() + 63) & ~
static_cast<size_t>(63);
442 auto* ptr =
reinterpret_cast<uint8_t*
>(aligned_alloc(64, heap_buf_size_aligned));
443 std::copy(heap_buf.begin(), heap_buf.end(), ptr);
449 const size_t num_elements =
buffer.size() /
sizeof(T);
451 for (
size_t i = 0; i < num_elements; ++i) {
452 elements.push_back(from_buffer<T>(
buffer, i *
sizeof(T)));
461 std::vector<uint8_t>
buf;
465 for (
auto e :
value) {
std::unique_ptr< uint8_t[]> buffer
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