diff --git a/ASTCEncoder/src/Decompressor.cpp b/ASTCEncoder/src/Decompressor.cpp index 4fcad5e..4658738 100644 --- a/ASTCEncoder/src/Decompressor.cpp +++ b/ASTCEncoder/src/Decompressor.cpp @@ -593,7 +593,7 @@ namespace ASTCC { uint32 Ds = (1024 + (blockWidth/2)) / (blockWidth - 1); uint32 Dt = (1024 + (blockHeight/2)) / (blockHeight - 1); - for(uint32 plane = 0; plane < (params.m_bDualPlane? 2 : 1); plane++) + for(uint32 plane = 0; plane < (params.m_bDualPlane? 2U : 1U); plane++) for(uint32 t = 0; t < blockHeight; t++) for(uint32 s = 0; s < blockWidth; s++) { uint32 cs = Ds * s; diff --git a/BPTCEncoder/src/RGBAEndpoints.cpp b/BPTCEncoder/src/RGBAEndpoints.cpp index f5aa349..18041da 100755 --- a/BPTCEncoder/src/RGBAEndpoints.cpp +++ b/BPTCEncoder/src/RGBAEndpoints.cpp @@ -79,9 +79,10 @@ #include "CompressionMode.h" #include +#include +#include #include #include -#include #ifndef min template @@ -228,7 +229,7 @@ double RGBACluster::QuantizedError( ) const { // nBuckets should be a power of two. - const uint8 indexPrec = log2(nBuckets); + const uint8 indexPrec = static_cast(log(static_cast(nBuckets))/log(2.0f)); assert(!(nBuckets & (nBuckets - 1))); assert(indexPrec >= 2 && indexPrec <= 4); @@ -293,8 +294,8 @@ double RGBACluster::QuantizedError( const int32 j2 = static_cast(pct * static_cast(nBuckets-1) + 0.7); #else const float pct = ((pt - uqp1) * uqpdir) / uqplsq; - int32 j1 = floor(pct * static_cast(nBuckets-1)); - int32 j2 = ceil(pct * static_cast(nBuckets-1)); + int32 j1 = static_cast(floor(pct * static_cast(nBuckets-1))); + int32 j2 = static_cast(ceil(pct * static_cast(nBuckets-1))); j1 = std::min(std::max(0, j1), nBuckets - 1); j2 = std::min(j2, nBuckets - 1); #endif diff --git a/Base/include/Bits.h b/Base/include/Bits.h index e593b8e..58138d9 100644 --- a/Base/include/Bits.h +++ b/Base/include/Bits.h @@ -70,8 +70,8 @@ namespace FasTC { public: explicit Bits(IntType &v) : m_Bits(v) { } - bool operator[](uint32 bitPos) { - return (m_Bits >> bitPos) & 1; + uint8 operator[](uint32 bitPos) { + return static_cast((m_Bits >> bitPos) & 1); } IntType operator()(uint32 start, uint32 end) { diff --git a/Base/include/MatrixSquare.h b/Base/include/MatrixSquare.h index 3270981..c11fb33 100644 --- a/Base/include/MatrixSquare.h +++ b/Base/include/MatrixSquare.h @@ -55,7 +55,7 @@ namespace FasTC { int numIterations = 0; VectorBase b; - T norm = 1.0/sqrt(static_cast(N)); + T norm = static_cast(1.0)/sqrt(static_cast(N)); for(int i = 0; i < N; i++) b[i] = norm; diff --git a/Base/test/TestPixel.cpp b/Base/test/TestPixel.cpp index 59c50da..71a3be3 100644 --- a/Base/test/TestPixel.cpp +++ b/Base/test/TestPixel.cpp @@ -82,7 +82,7 @@ TEST(Pixel, FourWideConstructor) { EXPECT_EQ(depth[i], 8); } - FasTC::Pixel q(static_cast(1 << 16), 6, -2, 5, 4); + FasTC::Pixel q(0, 6, -2, 5, 4); EXPECT_EQ(q.R(), 6); EXPECT_EQ(q.G(), -2); EXPECT_EQ(q.B(), 5);