Fix bug when going from smaller to higher bit depth

This commit is contained in:
Pavel Krajcevski 2013-08-31 16:04:58 -04:00
parent ad17404bf7
commit 9a0fbebac3

View File

@ -54,6 +54,7 @@
#include <cstring>
#include <cassert>
#include <algorithm>
namespace PVRTCC {
@ -119,8 +120,8 @@ namespace PVRTCC {
uint8 ret = 0;
while(bitsLeft > oldDepth) {
ret |= val;
ret <<= oldDepth;
bitsLeft -= oldDepth;
ret <<= std::min(bitsLeft, oldDepth);
}
return ret | (val >> (oldDepth - bitsLeft));