[Scummvm-cvs-logs] SF.net SVN: scummvm:[38715] scummvm/trunk/engines/sci/sfx/mixer/soft.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Feb 21 19:13:03 CET 2009


Revision: 38715
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38715&view=rev
Author:   fingolfin
Date:     2009-02-21 18:13:03 +0000 (Sat, 21 Feb 2009)

Log Message:
-----------
SCI: Simplified gcd (and fixed crash when a = 0, not that it would be relevant ;)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/mixer/soft.cpp

Modified: scummvm/trunk/engines/sci/sfx/mixer/soft.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/mixer/soft.cpp	2009-02-21 18:12:02 UTC (rev 38714)
+++ scummvm/trunk/engines/sci/sfx/mixer/soft.cpp	2009-02-21 18:13:03 UTC (rev 38715)
@@ -92,19 +92,13 @@
 	return SFX_OK;
 }
 
-static inline unsigned int gcd(unsigned int a, unsigned int b) {
-	if (a == b)
-		return a;
-
-	if (a < b) {
-		unsigned int c = b % a;
-
-		if (!c)
-			return a;
-
-		return gcd(c, a);
-	} else
-		return gcd(b, a);
+static inline uint gcd(uint a, uint b) {
+	while (a) {
+		uint c = b % a;
+		b = a;
+		a = c;
+	}
+	return b;
 }
 
 static sfx_pcm_urat_t urat(unsigned int nom, unsigned int denom) {


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