wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src util.hpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src util.hpp
Date: Wed, 19 Jan 2005 16:40:39 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/01/19 21:40:38

Modified files:
        src            : util.hpp 

Log message:
        Shut VC warning about unsigned types by casting to a signed type.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/util.hpp.diff?tr1=1.19&tr2=1.20&r1=text&r2=text

Patches:
Index: wesnoth/src/util.hpp
diff -u wesnoth/src/util.hpp:1.19 wesnoth/src/util.hpp:1.20
--- wesnoth/src/util.hpp:1.19   Sun Dec 26 21:58:18 2004
+++ wesnoth/src/util.hpp        Wed Jan 19 21:40:37 2005
@@ -1,4 +1,4 @@
-/* $Id: util.hpp,v 1.19 2004/12/26 21:58:18 silene Exp $ */
+/* $Id: util.hpp,v 1.20 2005/01/19 21:40:37 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -32,7 +32,10 @@
 inline const T& maximum(const T& a, const T& b) { return a < b ? b : a; }
 
 template<typename T>
-inline bool is_odd(T num) { return (static_cast<unsigned int>(num > 0 ? num : 
-num)&1) == 1; }
+inline bool is_odd(T num) {
+  int n = static_cast< int >(num);
+  return static_cast< unsigned int >(n >= 0 ? n : -n) & 1;
+}
 
 template<typename T>
 inline bool is_even(T num) { return !is_odd(num); }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]