Fixed unaligned memory accesses

This commit is contained in:
SChernykh 2025-03-20 19:00:02 +01:00
parent a66716c0b1
commit 55e12a3715
3 changed files with 10 additions and 2 deletions

View file

@ -42,7 +42,7 @@ public:
bool on_connect() override { return true; };
bool on_read(const char* data, uint32_t size) override { static_cast<ConsoleCommands*>(m_owner)->process_input(m_command, data, size); return true; };
char m_consoleReadBuf[1024] = {};
alignas(8) char m_consoleReadBuf[1024] = {};
std::string m_command;
};

View file

@ -100,7 +100,7 @@ private:
[[nodiscard]] bool on_connect() override;
[[nodiscard]] bool on_read(const char* data, uint32_t size) override;
char m_buf[BUF_SIZE];
alignas(8) char m_buf[BUF_SIZE];
std::vector<uint8_t> m_pendingData;
bool is_paired() const { return m_pairedClient && (m_pairedClient->m_resetCounter == m_pairedClientSavedResetCounter); }

View file

@ -152,8 +152,16 @@ void Miner::run(void* data)
{
WorkerData* d = static_cast<WorkerData*>(data);
LOGINFO(1, "worker thread " << d->m_index << '/' << d->m_count << " started");
char buf[16] = {};
log::Stream s(buf);
s << "Miner " << d->m_index << '/' << d->m_count;
set_thread_name(buf);
make_thread_background();
d->m_miner->run(d);
LOGINFO(1, "worker thread " << d->m_index << '/' << d->m_count << " stopped");
}