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 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;

View File

@ -79,9 +79,10 @@
#include "CompressionMode.h"
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cfloat>
#ifndef min
template <typename T>
@ -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<uint8>(log(static_cast<float>(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<int32>(pct * static_cast<float>(nBuckets-1) + 0.7);
#else
const float pct = ((pt - uqp1) * uqpdir) / uqplsq;
int32 j1 = floor(pct * static_cast<float>(nBuckets-1));
int32 j2 = ceil(pct * static_cast<float>(nBuckets-1));
int32 j1 = static_cast<int32>(floor(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);
j2 = std::min(j2, nBuckets - 1);
#endif

View File

@ -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<uint8>((m_Bits >> bitPos) & 1);
}
IntType operator()(uint32 start, uint32 end) {

View File

@ -55,7 +55,7 @@ namespace FasTC {
int numIterations = 0;
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++)
b[i] = norm;

View File

@ -82,7 +82,7 @@ TEST(Pixel, FourWideConstructor) {
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.G(), -2);
EXPECT_EQ(q.B(), 5);