Fix more compiler warnings

This commit is contained in:
Pavel Krajcevski 2013-01-28 17:37:43 -05:00
parent c7a2e24b07
commit 8c666bcd3f
6 changed files with 13 additions and 10 deletions

View file

@ -187,9 +187,9 @@ private:
}
else {
return (
(maskSeed >> (24 + m_Attributes->colorChannelPrecision - 1) & 0xFF) |
((maskSeed >> (24 + m_Attributes->colorChannelPrecision - 1) & 0xFF) |
(maskSeed >> (16 + m_Attributes->colorChannelPrecision - 1) & 0xFF00) |
(maskSeed >> (8 + m_Attributes->colorChannelPrecision - 1) & 0xFF0000) &
(maskSeed >> (8 + m_Attributes->colorChannelPrecision - 1) & 0xFF0000)) &
(0x00FFFFFF)
);
}

View file

@ -601,8 +601,11 @@ static inline float frand() {
// repeat the most significant bits of r in
// the least significant of the mantissa
const uint32 m = (r << 8) | (r >> 7);
const uint32 flt = (127 << 23) | m;
return *(reinterpret_cast<const float *>(&flt)) - 1.0f;
const union {
uint32 fltAsInt;
float flt;
} fltUnion = { (127 << 23) | m };
return fltUnion.flt - 1.0;
}
bool BC7CompressionMode::AcceptNewEndpointError(double newError, double oldError, float temp) const {
@ -664,7 +667,7 @@ double BC7CompressionMode::OptimizeEndpointsForCluster(const RGBACluster &cluste
int indices[kMaxNumDataPoints];
RGBAVector np1, np2;
int nPbitCombo;
int nPbitCombo = 0;
PickBestNeighboringEndpoints(cluster, p1, p2, curPbitCombo, np1, np2, nPbitCombo, visitedStates, lastVisitedState);

View file

@ -360,7 +360,6 @@ void RGBACluster::GetPrincipalAxis(RGBADir &axis) {
return;
}
RGBAVector avg = m_Total / float(m_NumPoints);
m_PowerMethodIterations = ::GetPrincipalAxis(
m_NumPoints,
m_DataPoints,

View file

@ -96,9 +96,9 @@ public:
{ }
RGBAVector(float _r, float _g, float _b, float _a) :
r(_r), g(_g), b(_b), a(_a) { }
r(_r), g(_g), b(_b), a(_a), idx(0) { }
explicit RGBAVector(float cc) : r(cc), g(cc), b(cc), a(cc) { }
explicit RGBAVector(float cc) : r(cc), g(cc), b(cc), a(cc), idx(0) { }
RGBAVector &operator =(const RGBAVector &other) {
this->idx = other.idx;

View file

@ -105,9 +105,9 @@ void BlockStat::ToString(CHAR *buf, int bufSz) const {
case BlockStat::eType_Int:
#ifdef _MSC_VER
_sntprintf_s(buf, bufSz, _TRUNCATE, "%s,%llu", m_StatName, m_IntStat);
_sntprintf_s(buf, bufSz, _TRUNCATE, "%s,%lu", m_StatName, m_IntStat);
#else
snprintf(buf, bufSz, "%s,%llu", m_StatName, m_IntStat);
snprintf(buf, bufSz, "%s,%lu", m_StatName, m_IntStat);
#endif
break;

View file

@ -67,6 +67,7 @@ StopWatch &StopWatch::operator=(const StopWatch &other) {
}
impl = new StopWatchImpl();
memcpy(impl, other.impl, sizeof(StopWatchImpl));
return *this;
}
StopWatch::~StopWatch() {