1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Merge pull request #5004 from IvanSavenko/int64_fix

Fix deserialization of int64 values
This commit is contained in:
Ivan Savenko 2024-12-02 13:06:34 +02:00 committed by GitHub
commit 90fb5ac9c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,12 +131,12 @@ public:
if ((byteValue & 0x80) != 0)
{
valueUnsigned |= (byteValue & 0x7f) << offset;
valueUnsigned |= static_cast<uint64_t>(byteValue & 0x7f) << offset;
offset += 7;
}
else
{
valueUnsigned |= (byteValue & 0x3f) << offset;
valueUnsigned |= static_cast<uint64_t>(byteValue & 0x3f) << offset;
bool isNegative = (byteValue & 0x40) != 0;
if (isNegative)
return -static_cast<int64_t>(valueUnsigned);