[Scummvm-cvs-logs] SF.net SVN: scummvm:[53606] scummvm/trunk/engines/sword25

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Oct 19 11:43:32 CEST 2010


Revision: 53606
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53606&view=rev
Author:   fingolfin
Date:     2010-10-19 09:43:31 +0000 (Tue, 19 Oct 2010)

Log Message:
-----------
SWORD25: Optimize ReverseArray, move it to only place it is used

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/kernel/kernel.h
    scummvm/trunk/engines/sword25/math/walkregion.cpp

Modified: scummvm/trunk/engines/sword25/kernel/kernel.h
===================================================================
--- scummvm/trunk/engines/sword25/kernel/kernel.h	2010-10-19 09:43:08 UTC (rev 53605)
+++ scummvm/trunk/engines/sword25/kernel/kernel.h	2010-10-19 09:43:31 UTC (rev 53606)
@@ -349,18 +349,6 @@
 	Service*(*CreateMethod)(Kernel *);
 };
 
-template<class T>
-void ReverseArray(Common::Array<T> &Arr) {
-	if (Arr.size() < 2)
-		return;
-
-	for (uint i = 0; i <= (Arr.size() / 2 - 1); ++i) {
-		T temp = Arr[i];
-		Arr[i] = Arr[Arr.size() - i - 1];
-		Arr[Arr.size() - i - 1] = temp;
-	}
-}
-
 } // End of namespace Sword25
 
 #endif

Modified: scummvm/trunk/engines/sword25/math/walkregion.cpp
===================================================================
--- scummvm/trunk/engines/sword25/math/walkregion.cpp	2010-10-19 09:43:08 UTC (rev 53605)
+++ scummvm/trunk/engines/sword25/math/walkregion.cpp	2010-10-19 09:43:31 UTC (rev 53606)
@@ -164,6 +164,17 @@
 	}
 }
 
+template<class T>
+void ReverseArray(Common::Array<T> &arr) {
+	const uint size = arr.size();
+	if (size < 2)
+		return;
+
+	for (uint i = 0; i <= (size / 2 - 1); ++i) {
+		SWAP(arr[i], arr[size - i - 1]);
+	}
+}
+
 bool WalkRegion::findPath(const Vertex &start, const Vertex &end, BS_Path &path) const {
 	// This is an implementation of Dijkstra's algorithm
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list