Revert "Bypass alignment related copy whenever possible (#1443)"

This reverts commit 235d4f8957ee4566d6217783638fa58a586bb35a.

old-commit-hash: d5ca841b0f18d2e707eb1f73afac842ede9be7e8
This commit is contained in:
George Hotz
2020-05-04 09:54:05 -07:00
parent 004c0e277b
commit 16cbb5e255
10 changed files with 121 additions and 95 deletions
+8 -4
View File
@@ -15,7 +15,6 @@
#include "common/messaging.h"
#include "common/params.h"
#include "common/timing.h"
#include "common/messagehelp.h"
#include "messaging.hpp"
#include "locationd_yawrate.h"
@@ -106,10 +105,14 @@ int main(int argc, char *argv[]) {
int save_counter = 0;
while (true){
for (auto s : poller->poll(100)){
MessageReader amsg = s->receive();
if (!amsg) continue;
Message * msg = s->receive();
auto amsg = kj::heapArray<capnp::word>((msg->getSize() / sizeof(capnp::word)) + 1);
memcpy(amsg.begin(), msg->getData(), msg->getSize());
capnp::FlatArrayMessageReader capnp_msg(amsg);
cereal::Event::Reader event = capnp_msg.getRoot<cereal::Event>();
auto event = amsg.getEvent();
localizer.handle_log(event);
auto which = event.which();
@@ -169,6 +172,7 @@ int main(int argc, char *argv[]) {
});
}
}
delete msg;
}
}
+11 -6
View File
@@ -23,7 +23,6 @@
#include "common/params.h"
#include "common/swaglog.h"
#include "common/timing.h"
#include "common/messagehelp.h"
#include "ublox_msg.h"
@@ -55,12 +54,17 @@ int ubloxd_main(poll_ubloxraw_msg_func poll_func, send_gps_event_func send_func)
while (!do_exit) {
MessageReader amsg = poll_func(poller);
if (!amsg) continue;
Message * msg = poll_func(poller);
if (msg == NULL) continue;
auto ubloxRaw = amsg.getEvent().getUbloxRaw();
const uint8_t *data = ubloxRaw.begin();
size_t len = ubloxRaw.size();
auto amsg = kj::heapArray<capnp::word>((msg->getSize() / sizeof(capnp::word)) + 1);
memcpy(amsg.begin(), msg->getData(), msg->getSize());
capnp::FlatArrayMessageReader cmsg(amsg);
cereal::Event::Reader event = cmsg.getRoot<cereal::Event>();
const uint8_t *data = event.getUbloxRaw().begin();
size_t len = event.getUbloxRaw().size();
size_t bytes_consumed = 0;
while(bytes_consumed < len && !do_exit) {
size_t bytes_consumed_this_time = 0U;
@@ -110,6 +114,7 @@ int ubloxd_main(poll_ubloxraw_msg_func poll_func, send_gps_event_func send_func)
}
bytes_consumed += bytes_consumed_this_time;
}
delete msg;
}
delete poller;