Fix some compiler warnings

This commit is contained in:
Pavel Krajcevski 2014-04-15 14:18:12 -04:00
parent 03b9e7f413
commit c40829a3b7
5 changed files with 10 additions and 9 deletions

View File

@ -593,7 +593,7 @@ namespace ASTCC {
uint32 Ds = (1024 + (blockWidth/2)) / (blockWidth - 1); uint32 Ds = (1024 + (blockWidth/2)) / (blockWidth - 1);
uint32 Dt = (1024 + (blockHeight/2)) / (blockHeight - 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 t = 0; t < blockHeight; t++)
for(uint32 s = 0; s < blockWidth; s++) { for(uint32 s = 0; s < blockWidth; s++) {
uint32 cs = Ds * s; uint32 cs = Ds * s;

View File

@ -79,9 +79,10 @@
#include "CompressionMode.h" #include "CompressionMode.h"
#include <cassert> #include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#include <cfloat>
#ifndef min #ifndef min
template <typename T> template <typename T>
@ -228,7 +229,7 @@ double RGBACluster::QuantizedError(
) const { ) const {
// nBuckets should be a power of two. // nBuckets should be a power of two.
const uint8 indexPrec = log2(nBuckets); const uint8 indexPrec = static_cast<uint8>(log(static_cast<float>(nBuckets))/log(2.0f));
assert(!(nBuckets & (nBuckets - 1))); assert(!(nBuckets & (nBuckets - 1)));
assert(indexPrec >= 2 && indexPrec <= 4); assert(indexPrec >= 2 && indexPrec <= 4);
@ -293,8 +294,8 @@ double RGBACluster::QuantizedError(
const int32 j2 = static_cast<int32>(pct * static_cast<float>(nBuckets-1) + 0.7); const int32 j2 = static_cast<int32>(pct * static_cast<float>(nBuckets-1) + 0.7);
#else #else
const float pct = ((pt - uqp1) * uqpdir) / uqplsq; const float pct = ((pt - uqp1) * uqpdir) / uqplsq;
int32 j1 = floor(pct * static_cast<float>(nBuckets-1)); int32 j1 = static_cast<int32>(floor(pct * static_cast<float>(nBuckets-1)));
int32 j2 = ceil(pct * static_cast<float>(nBuckets-1)); int32 j2 = static_cast<int32>(ceil(pct * static_cast<float>(nBuckets-1)));
j1 = std::min(std::max(0, j1), nBuckets - 1); j1 = std::min(std::max(0, j1), nBuckets - 1);
j2 = std::min(j2, nBuckets - 1); j2 = std::min(j2, nBuckets - 1);
#endif #endif

View File

@ -70,8 +70,8 @@ namespace FasTC {
public: public:
explicit Bits(IntType &v) : m_Bits(v) { } explicit Bits(IntType &v) : m_Bits(v) { }
bool operator[](uint32 bitPos) { uint8 operator[](uint32 bitPos) {
return (m_Bits >> bitPos) & 1; return static_cast<uint8>((m_Bits >> bitPos) & 1);
} }
IntType operator()(uint32 start, uint32 end) { IntType operator()(uint32 start, uint32 end) {

View File

@ -55,7 +55,7 @@ namespace FasTC {
int numIterations = 0; int numIterations = 0;
VectorBase<T, N> b; VectorBase<T, N> b;
T norm = 1.0/sqrt(static_cast<T>(N)); T norm = static_cast<T>(1.0)/sqrt(static_cast<T>(N));
for(int i = 0; i < N; i++) for(int i = 0; i < N; i++)
b[i] = norm; b[i] = norm;

View File

@ -82,7 +82,7 @@ TEST(Pixel, FourWideConstructor) {
EXPECT_EQ(depth[i], 8); EXPECT_EQ(depth[i], 8);
} }
FasTC::Pixel q(static_cast<uint16>(1 << 16), 6, -2, 5, 4); FasTC::Pixel q(0, 6, -2, 5, 4);
EXPECT_EQ(q.R(), 6); EXPECT_EQ(q.R(), 6);
EXPECT_EQ(q.G(), -2); EXPECT_EQ(q.G(), -2);
EXPECT_EQ(q.B(), 5); EXPECT_EQ(q.B(), 5);