[Scummvm-cvs-logs] scummvm master -> 54f25aa84373715001c56155673fb59cfe44b573

digitall digitall at scummvm.org
Tue Jul 19 03:33:28 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
54f25aa843 COMMON: Renamed Integer Log2 function from log2 to intLog2.


Commit: 54f25aa84373715001c56155673fb59cfe44b573
    https://github.com/scummvm/scummvm/commit/54f25aa84373715001c56155673fb59cfe44b573
Author: D G Turner (digitall at scummvm.org)
Date: 2011-07-18T18:29:13-07:00

Commit Message:
COMMON: Renamed Integer Log2 function from log2 to intLog2.

This avoids naming collisions with system libraries on some platforms
i.e. DS, DC where the log2 is realised by macro.

Changed paths:
    audio/decoders/qdm2.cpp
    common/math.h
    video/bink_decoder.cpp



diff --git a/audio/decoders/qdm2.cpp b/audio/decoders/qdm2.cpp
index 842ca58..19b30217 100644
--- a/audio/decoders/qdm2.cpp
+++ b/audio/decoders/qdm2.cpp
@@ -1822,11 +1822,11 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *extraData, DisposeAfterUse::F
 			warning("QDM2Stream::QDM2Stream() u4 field not 0");
 	}
 
-	_fftOrder = log2(_frameSize) + 1;
+	_fftOrder = Common::intLog2(_frameSize) + 1;
 	_fftFrameSize = 2 * _frameSize; // complex has two floats
 
 	// something like max decodable tones
-	_groupOrder = log2(_blockSize) + 1;
+	_groupOrder = Common::intLog2(_blockSize) + 1;
 	_sFrameSize = _blockSize / 16; // 16 iterations per super block
 
 	_subSampling = _fftOrder - 7;
diff --git a/common/math.h b/common/math.h
index 2ad71ce..d1f3e77 100644
--- a/common/math.h
+++ b/common/math.h
@@ -61,7 +61,7 @@ static const char LogTable256[256] = {
 	LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7), LT(7)
 };
 
-inline uint32 log2(uint32 v) {
+inline uint32 intLog2(uint32 v) {
 	register uint32 t, tt;
 
 	if ((tt = v >> 16))
diff --git a/video/bink_decoder.cpp b/video/bink_decoder.cpp
index a21582e..1f3190d 100644
--- a/video/bink_decoder.cpp
+++ b/video/bink_decoder.cpp
@@ -701,15 +701,15 @@ void BinkDecoder::initBundles() {
 	for (int i = 0; i < 2; i++) {
 		int width = MAX<uint32>(cw[i], 8);
 
-		_bundles[kSourceBlockTypes   ].countLengths[i] = Common::log2((width  >> 3)    + 511) + 1;
-		_bundles[kSourceSubBlockTypes].countLengths[i] = Common::log2((width  >> 4)    + 511) + 1;
-		_bundles[kSourceColors       ].countLengths[i] = Common::log2((width  >> 3)*64 + 511) + 1;
-		_bundles[kSourceIntraDC      ].countLengths[i] = Common::log2((width  >> 3)    + 511) + 1;
-		_bundles[kSourceInterDC      ].countLengths[i] = Common::log2((width  >> 3)    + 511) + 1;
-		_bundles[kSourceXOff         ].countLengths[i] = Common::log2((width  >> 3)    + 511) + 1;
-		_bundles[kSourceYOff         ].countLengths[i] = Common::log2((width  >> 3)    + 511) + 1;
-		_bundles[kSourcePattern      ].countLengths[i] = Common::log2((cbw[i] << 3)    + 511) + 1;
-		_bundles[kSourceRun          ].countLengths[i] = Common::log2((width  >> 3)*48 + 511) + 1;
+		_bundles[kSourceBlockTypes   ].countLengths[i] = Common::intLog2((width  >> 3)    + 511) + 1;
+		_bundles[kSourceSubBlockTypes].countLengths[i] = Common::intLog2((width  >> 4)    + 511) + 1;
+		_bundles[kSourceColors       ].countLengths[i] = Common::intLog2((width  >> 3)*64 + 511) + 1;
+		_bundles[kSourceIntraDC      ].countLengths[i] = Common::intLog2((width  >> 3)    + 511) + 1;
+		_bundles[kSourceInterDC      ].countLengths[i] = Common::intLog2((width  >> 3)    + 511) + 1;
+		_bundles[kSourceXOff         ].countLengths[i] = Common::intLog2((width  >> 3)    + 511) + 1;
+		_bundles[kSourceYOff         ].countLengths[i] = Common::intLog2((width  >> 3)    + 511) + 1;
+		_bundles[kSourcePattern      ].countLengths[i] = Common::intLog2((cbw[i] << 3)    + 511) + 1;
+		_bundles[kSourceRun          ].countLengths[i] = Common::intLog2((width  >> 3)*48 + 511) + 1;
 	}
 }
 
@@ -1426,7 +1426,7 @@ void BinkDecoder::audioBlock(AudioTrack &audio, int16 *out) {
 
 	if (!audio.first) {
 		int count = audio.overlapLen * audio.channels;
-		int shift = Common::log2(count);
+		int shift = Common::intLog2(count);
 		for (int i = 0; i < count; i++) {
 			out[i] = (audio.prevCoeffs[i] * (count - i) + out[i] * i) >> shift;
 		}






More information about the Scummvm-git-logs mailing list