diff --git a/BPTCEncoder/src/BC7CompressionMode.h b/BPTCEncoder/src/BC7CompressionMode.h index 27187ac..a6e9530 100755 --- a/BPTCEncoder/src/BC7CompressionMode.h +++ b/BPTCEncoder/src/BC7CompressionMode.h @@ -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) ); } diff --git a/BPTCEncoder/src/BC7Compressor.cpp b/BPTCEncoder/src/BC7Compressor.cpp index 8115f21..161d91e 100755 --- a/BPTCEncoder/src/BC7Compressor.cpp +++ b/BPTCEncoder/src/BC7Compressor.cpp @@ -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(&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); diff --git a/BPTCEncoder/src/RGBAEndpoints.cpp b/BPTCEncoder/src/RGBAEndpoints.cpp index 9eb2054..fd0c83d 100755 --- a/BPTCEncoder/src/RGBAEndpoints.cpp +++ b/BPTCEncoder/src/RGBAEndpoints.cpp @@ -360,7 +360,6 @@ void RGBACluster::GetPrincipalAxis(RGBADir &axis) { return; } - RGBAVector avg = m_Total / float(m_NumPoints); m_PowerMethodIterations = ::GetPrincipalAxis( m_NumPoints, m_DataPoints, diff --git a/BPTCEncoder/src/RGBAEndpoints.h b/BPTCEncoder/src/RGBAEndpoints.h index 2f62792..8617890 100755 --- a/BPTCEncoder/src/RGBAEndpoints.h +++ b/BPTCEncoder/src/RGBAEndpoints.h @@ -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; diff --git a/Core/src/BlockStats.cpp b/Core/src/BlockStats.cpp index a6be70b..9ff3f7c 100644 --- a/Core/src/BlockStats.cpp +++ b/Core/src/BlockStats.cpp @@ -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; diff --git a/Core/src/StopWatchUnix.cpp b/Core/src/StopWatchUnix.cpp index 1e1d98b..3694b68 100644 --- a/Core/src/StopWatchUnix.cpp +++ b/Core/src/StopWatchUnix.cpp @@ -67,6 +67,7 @@ StopWatch &StopWatch::operator=(const StopWatch &other) { } impl = new StopWatchImpl(); memcpy(impl, other.impl, sizeof(StopWatchImpl)); + return *this; } StopWatch::~StopWatch() {