diff --git a/PVRTCEncoder/src/Pixel.cpp b/PVRTCEncoder/src/Pixel.cpp index 2b01800..74f03e5 100644 --- a/PVRTCEncoder/src/Pixel.cpp +++ b/PVRTCEncoder/src/Pixel.cpp @@ -54,6 +54,7 @@ #include #include +#include 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));