gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1674-ga8f0352
Date: Thu, 18 Jul 2013 10:03:05 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  a8f0352302b74e64636461be3991b32215e4e9c0 (commit)
      from  75671d174cc31134e001b879f73aeae4a6d89dc6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=a8f0352302b74e64636461be3991b32215e4e9c0


commit a8f0352302b74e64636461be3991b32215e4e9c0
Author: Bastiaan Jacques <address@hidden>
Date:   Thu Jul 18 12:02:27 2013 +0200

    Make sure truncateWithFactor(nan) works the same everywhere.

diff --git a/libbase/GnashNumeric.h b/libbase/GnashNumeric.h
index 43f7c0f..efbd0ff 100644
--- a/libbase/GnashNumeric.h
+++ b/libbase/GnashNumeric.h
@@ -35,6 +35,7 @@
 #include <boost/cstdint.hpp>
 #include <limits>
 #include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_floating_point.hpp>
 
 namespace gnash {
 
@@ -56,6 +57,14 @@ isFinite(double d)
 #endif
 }
 
+template <typename T>
+inline
+typename boost::enable_if<boost::is_floating_point<T>, bool>::type
+isNaN(const T& num)
+{
+        return num != num;
+}
+
 inline double
 infinite_to_zero(double x)
 {
@@ -92,7 +101,13 @@ twipsToPixels(int i)
 template<size_t Factor>
 boost::int32_t
 truncateWithFactor(double a)
-{ 
+{
+    // If a is NaN, then this function would return -NAN, which when cast to
+    // int32, converts to zero on x86*, but converts to -1 on ARM. The
+    // behaviour is undefined according to ISO-IEC 14882:2003 4.9.1.
+    if (isNaN(a)) {
+        return 0;
+    }
 
     const double factor = static_cast<double>(Factor);
 
diff --git a/libcore/as_value.h b/libcore/as_value.h
index 4c7ab67..0adc302 100644
--- a/libcore/as_value.h
+++ b/libcore/as_value.h
@@ -23,13 +23,13 @@
 #include <string>
 #include <boost/variant.hpp>
 #include <iosfwd> // for inlined output operator
-#include <boost/type_traits/is_floating_point.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/cstdint.hpp>
 
 #include "utility.h" // for UNUSED
 #include "dsodefs.h" // for DSOTEXPORT
 #include "CharacterProxy.h"
+#include "GnashNumeric.h" // for isNaN
 
 
 // Forward declarations
@@ -52,17 +52,6 @@ namespace gnash {
 // NaN constant for use in as_value implementation
 static const double NaN = std::numeric_limits<double>::quiet_NaN();
 
-// The following template works just like its C counterpart, with added
-// type safety (i.e., they will only compile for floating point arguments).
-template <typename T>
-inline bool
-isNaN(const T& num, typename boost::enable_if<boost::is_floating_point<T> >::
-        type* dummy = 0)
-{
-       UNUSED(dummy);
-       return num != num;
-}
-
 template <typename T>
 inline bool
 isInf(const T& num)

-----------------------------------------------------------------------

Summary of changes:
 libbase/GnashNumeric.h |   17 ++++++++++++++++-
 libcore/as_value.h     |   13 +------------
 2 files changed, 17 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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