From: <sag...@us...> - 2013-01-12 17:50:35
|
Revision: 1486 http://sourceforge.net/p/modplug/code/1486 Author: saga-games Date: 2013-01-12 17:50:23 +0000 (Sat, 12 Jan 2013) Log Message: ----------- [Ref] Changed x % 2 to x % 2u (slightly better assembly output, not that it matters but whatever) Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Load_wav.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-01-12 17:04:55 UTC (rev 1485) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-01-12 17:50:23 UTC (rev 1486) @@ -1170,7 +1170,7 @@ // Success - if((wdh.length % 2) != 0) + if((wdh.length % 2u) != 0) { // Write padding byte if sample size is odd. int8 padding = 0; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-01-12 17:04:55 UTC (rev 1485) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-01-12 17:50:23 UTC (rev 1486) @@ -2109,12 +2109,12 @@ if(m_nOutputs > 2) { // first, mix extra outputs on a stereo basis - UINT nOuts = m_nOutputs; + uint32 numOutputs = m_nOutputs; // so if nOuts is not even, let process the last output later - if((nOuts % 2) == 1) nOuts--; + if((numOutputs % 2u) == 1) numOutputs--; // mix extra stereo outputs - for(UINT iOut = 2; iOut < nOuts; iOut++) + for(uint32 iOut = 2; iOut < numOutputs; iOut++) { for(size_t i = 0; i < nSamples; i++) { @@ -2123,12 +2123,12 @@ } // if m_nOutputs is odd, mix half the signal of last output to each channel - if(nOuts != m_nOutputs) + if(numOutputs != m_nOutputs) { // trick : if we are here, nOuts = m_nOutputs - 1 !!! for(size_t i = 0; i < nSamples; i++) { - float v = 0.5f * outputBuffers[nOuts][i]; + float v = 0.5f * outputBuffers[numOutputs][i]; outputBuffers[0][i] += v; outputBuffers[1][i] += v; } Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-01-12 17:04:55 UTC (rev 1485) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-01-12 17:50:23 UTC (rev 1486) @@ -2284,7 +2284,7 @@ CASE('MSF.', m_ModFlags); case 'MIMA': GetMIDIMapper().Deserialize(chunk.GetRawData(), size); break; case 'ChnS': - if(size <= (MAX_BASECHANNELS - 64) * 2 && (size % 2) == 0) + if(size <= (MAX_BASECHANNELS - 64) * 2 && (size % 2u) == 0) { STATIC_ASSERT(CountOf(ChnSettings) >= 64); const uint16 loopLimit = Util::Min(size / 2, CountOf(ChnSettings) - 64); Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2013-01-12 17:04:55 UTC (rev 1485) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2013-01-12 17:50:23 UTC (rev 1486) @@ -279,7 +279,7 @@ { SmpLength writeLength = mptSmp.pSample != nullptr ? mptSmp.nLength : 0; // If the sample size is odd, we have to add a padding byte, as all sample sizes in MODs are even. - if((writeLength % 2) != 0) + if((writeLength % 2u) != 0) { writeLength++; } @@ -505,7 +505,7 @@ } // From mikmod: if the file says FLT8, but the orderlist has odd numbers, it's probably really an FLT4 - if(isFLT8 && (Order[ord] % 2) != 0) + if(isFLT8 && (Order[ord] % 2u) != 0) { m_nChannels = 4; isFLT8 = false; @@ -624,7 +624,7 @@ if(isFLT8) { - if((pat % 2) == 0) + if((pat % 2u) == 0) { // Only create "even" patterns for FLT8 files if(Patterns.Insert(pat / 2, 64)) @@ -648,7 +648,7 @@ for(ROWINDEX row = 0; row < 64; row++) { // FLT8: either write to channel 1 to 4 (even patterns) or 5 to 8 (odd patterns). - ModCommand *rowBase = Patterns[actualPattern].GetpModCommand(row, ((pat % 2) == 0 || !isFLT8) ? 0: 4); + ModCommand *rowBase = Patterns[actualPattern].GetpModCommand(row, ((pat % 2u) == 0 || !isFLT8) ? 0 : 4); for(CHANNELINDEX chn = 0; chn < readChannels; chn++) { @@ -929,7 +929,7 @@ } // Write padding byte if the sample size is odd. - if((sample.nLength % 2) != 0) + if((sample.nLength % 2u) != 0) { fwrite(&silence[0], 1, 1, f); } Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2013-01-12 17:04:55 UTC (rev 1485) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2013-01-12 17:50:23 UTC (rev 1486) @@ -757,7 +757,7 @@ if(writeOrders < 2) { writeOrders = 2; - } else if((writeOrders % 2) != 0) + } else if((writeOrders % 2u) != 0) { // Number of orders should be even writeOrders++; Modified: trunk/OpenMPT/soundlib/Load_wav.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_wav.cpp 2013-01-12 17:04:55 UTC (rev 1485) +++ trunk/OpenMPT/soundlib/Load_wav.cpp 2013-01-12 17:50:23 UTC (rev 1486) @@ -92,7 +92,7 @@ for(CHANNELINDEX channel = 0; channel < wavFile.GetNumChannels(); channel++) { - ChnSettings[channel].nPan = (channel % 2) ? 256 : 0; + ChnSettings[channel].nPan = (channel % 2u) ? 256 : 0; ChnSettings[channel].nVolume = 64; ChnSettings[channel].dwFlags.reset(); } Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-01-12 17:04:55 UTC (rev 1485) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-01-12 17:50:23 UTC (rev 1486) @@ -418,12 +418,12 @@ data.length = sample.GetSampleSizeInBytes(); header.filesize += data.length; - if((data.length % 2) != 0) + if((data.length % 2u) != 0) { // Write padding byte if sample size is odd. header.filesize++; } - if((softwareIdLength % 2) != 0) + if((softwareIdLength % 2u) != 0) { header.filesize++; } @@ -467,7 +467,7 @@ (sample.uFlags & CHN_16BIT) ? SampleIO::signedPCM : SampleIO::unsignedPCM) .WriteSample(f, sample); - if((data.length % 2) != 0) + if((data.length % 2u) != 0) { // Write padding byte if sample size is odd. int8 padding = 0; @@ -492,7 +492,7 @@ list.list_len = LittleEndian(softwareIdLength); fwrite(&list, 1, 8, f); fwrite(softwareId, 1, list.list_len, f); - if((softwareIdLength % 2) != 0) + if((softwareIdLength % 2u) != 0) { int8 padding = 0; fwrite(&padding, 1, 1, f); @@ -1410,7 +1410,7 @@ break; } markers.push_back(marker); - markerChunk.Skip(marker.nameLength + ((marker.nameLength % 2) == 0 ? 1 : 0)); + markerChunk.Skip(marker.nameLength + ((marker.nameLength % 2u) == 0 ? 1 : 0)); } if(instrHeader.sustainLoop.playMode != AIFFInstrumentLoop::noLoop) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |