0
0
mirror of https://github.com/yse/easy_profiler.git synced 2025-01-14 00:27:55 +08:00

Removed unnecessary syntax and removed a use of constexpr that doesn't compile with MSVC 2013 (slight readability hit).

This commit is contained in:
rationalcoder 2017-08-31 19:37:21 -05:00
parent 186db6691a
commit bd1f6e49a3

View File

@ -451,7 +451,7 @@ public:
{
// Temp to avoid extra load due to this* aliasing.
uint16_t chunkOffset = m_chunkOffset;
char* data = (char*)&m_chunks.back().data[0] + chunkOffset;
char* data = (char*)m_chunks.back().data + chunkOffset;
chunkOffset += n + sizeof(uint16_t);
m_chunkOffset = chunkOffset;
@ -523,14 +523,13 @@ public:
// The maximum chunk offset is N-sizeof(uint16_t) b/c, if we hit that (or go past),
// there is either no space left, 1 byte left, or 2 bytes left, all of which are
// too small to cary more than a zero-sized element.
constexpr int_fast32_t MAX_CHUNK_OFFSET = (int_fast32_t)N-sizeof(uint16_t);
chunk* current = m_chunks.last;
do {
const char* data = (char*)current->data;
int_fast32_t chunkOffset = 0; // signed int so overflow is not checked.
uint16_t payloadSize = unaligned_load16<uint16_t>(data);
while ((chunkOffset < MAX_CHUNK_OFFSET) & (payloadSize != 0)) {
while ((chunkOffset < (N-sizeof(uint16_t))) & (payloadSize != 0)) {
const uint16_t chunkSize = sizeof(uint16_t) + payloadSize;
_outputStream.write(data, chunkSize);
data += chunkSize;