Skip to content

Commit 6975f95

Browse files
committed
github
1 parent 05e73bd commit 6975f95

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ inline void BitStreamWriter::writeVarNum(
628628
if (hasNextByte)
629629
{
630630
numBits--;
631-
byte |= static_cast<uint8_t>(0x01U << numBits); // use bit 6 if signed bit is present, use bit 7 otherwise
631+
uint8_t add = static_cast<uint8_t>(0x01U << numBits);
632+
byte = static_cast<uint8_t>(byte | add); // use bit 6 if signed bit is present, use bit 7 otherwise
632633
}
633634
else // this is the last byte
634635
{
@@ -637,8 +638,8 @@ inline void BitStreamWriter::writeVarNum(
637638
}
638639

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

0 commit comments

Comments
 (0)