fix code in order to support cmake unity builds

This commit is contained in:
tnixeu 2022-10-26 23:15:14 +02:00 committed by Patrick Ziegler
parent 10cdec3b9f
commit ed6a0e90fb
2 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,4 @@
#pragma once
#include <cassert>
#include "components/builder.hpp"

View File

@ -11,11 +11,11 @@ namespace ipc {
size_t total_size = HEADER_SIZE + payload.size();
std::vector<uint8_t> data(total_size);
auto* header = reinterpret_cast<ipc::header*>(data.data());
std::copy(ipc::MAGIC.begin(), ipc::MAGIC.end(), header->s.magic);
header->s.version = ipc::VERSION;
header->s.size = payload.size();
header->s.type = type;
auto* msg_header = reinterpret_cast<header*>(data.data());
std::copy(MAGIC.begin(), MAGIC.end(), msg_header->s.magic);
msg_header->s.version = VERSION;
msg_header->s.size = payload.size();
msg_header->s.type = type;
std::copy(payload.begin(), payload.end(), data.begin() + HEADER_SIZE);
return data;