Skip to content

Commit 05e73bd

Browse files
committed
github
1 parent b1c0e6d commit 05e73bd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler/extensions/cpp/runtime/src/zserio/BitStreamWriter.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,8 @@ inline void BitStreamWriter::writeVarNum(
637637
}
638638

639639
const size_t shiftBits = (numVarBytes - (i + 1)) * 7 + ((hasMaxByteRange && hasNextByte) ? 1 : 0);
640-
byte |= static_cast<uint8_t>((value >> shiftBits) & bitMasks[numBits - 1]);
640+
uint8_t val = static_cast<uint8_t>((value >> shiftBits) & bitMasks[numBits - 1]);
641+
byte = static_cast<uint8_t>(byte | val);
641642
writeUnsignedBits(byte, 8);
642643
}
643644
}

compiler/extensions/cpp/runtime/test/zserio/BitStreamWriterTest.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ TEST_F(BitStreamWriterTest, writeUnalignedData)
135135
uint8_t writtenTestValue = static_cast<uint8_t>(bitBuffer.getData()[offset / 8U] << (offset % 8U));
136136
if (offset % 8 != 0)
137137
{
138-
writtenTestValue |=
139-
static_cast<uint8_t>(bitBuffer.getData()[offset / 8U + 1U] >> (8U - (offset % 8U)));
138+
uint8_t val = static_cast<uint8_t>(bitBuffer.getData()[offset / 8U + 1U] >> (8U - (offset % 8U)));
139+
writtenTestValue = static_cast<uint8_t>(writtenTestValue | val);
140140
}
141141
ASSERT_EQ(testValue, writtenTestValue) << "Offset: " << offset;
142142
}

0 commit comments

Comments
 (0)