Small optimization bit in deserializeVarintCommon

Remove the end of varint flag from uchar value already, since we don't
use the top-most integer bits when applying the mask, so this can be
done at initialization already.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: Iba15265047d7d72d63ce47ab7b8980184d9b4a4f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Alexey Edelev 2024-10-02 00:13:02 +02:00
parent e45334f4a0
commit 3ed41b5cd7
1 changed files with 2 additions and 2 deletions

View File

@ -261,8 +261,8 @@ template <typename V, if_unsigned_int<V> = true>
while (true) {
if (it.bytesLeft() == 0)
return std::nullopt;
quint64 byte = quint64(static_cast<unsigned char>(*it));
value += (byte & 0b01111111) << k;
quint64 byte = quint64(static_cast<unsigned char>(*it) & 0b01111111);
value += byte << k;
k += 7;
if (((*it++) & 0b10000000) == 0)
break;