Fix undefined behavior in DataBlockCache::SetBlockCount()

Left-shifting negative signed numbers is UB (and pointlessly complex
here anyway).
This commit is contained in:
Thomas Goyne 2015-11-25 18:28:25 -08:00
parent 652a250189
commit 4542204b3a
1 changed files with 2 additions and 3 deletions

View File

@ -119,9 +119,8 @@ public:
if (data.size() > 0)
Age(0);
macroblock_size = 1 << MacroblockExponent;
macroblock_index_mask = ~(((~0) >> MacroblockExponent) << MacroblockExponent);
macroblock_size = 1UL << MacroblockExponent;
macroblock_index_mask = macroblock_size - 1;
data.resize((block_count + macroblock_size - 1) >> MacroblockExponent);
size = 0;