[Scummvm-cvs-logs] SF.net SVN: scummvm:[55838] scummvm/trunk/common/algorithm.h

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Feb 9 01:11:39 CET 2011


Revision: 55838
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55838&view=rev
Author:   fingolfin
Date:     2011-02-09 00:11:39 +0000 (Wed, 09 Feb 2011)

Log Message:
-----------
COMMON: Add comment that explains strange <= checks in gcd()

Modified Paths:
--------------
    scummvm/trunk/common/algorithm.h

Modified: scummvm/trunk/common/algorithm.h
===================================================================
--- scummvm/trunk/common/algorithm.h	2011-02-08 23:07:11 UTC (rev 55837)
+++ scummvm/trunk/common/algorithm.h	2011-02-09 00:11:39 UTC (rev 55838)
@@ -242,6 +242,9 @@
  */
 template<class T>
 T gcd(T a, T b) {
+	// Note: We check for <= instead of < to avoid spurious compiler
+	// warnings if T is an unsigned type, i.e. warnings like "comparison
+	// of unsigned expression < 0 is always false".
 	if (a <= 0)
 		a = -a;
 	if (b <= 0)


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