From 04a6d2789e65c41b616380fcb89d66c183918eaa Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 14 Feb 2017 17:05:16 -0300 Subject: [PATCH] Revert "Make nan==nan true for GDScript" --- core/math/math_2d.cpp | 7 ---- core/math/math_2d.h | 3 -- core/math/plane.cpp | 5 --- core/math/plane.h | 1 - core/math/quat.cpp | 19 ----------- core/math/quat.h | 2 +- core/math/vector3.cpp | 11 ------- core/math/vector3.h | 1 - core/variant_op.cpp | 76 ++++++++++++++----------------------------- 9 files changed, 26 insertions(+), 99 deletions(-) diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index 995cb0834a6..76eeece688b 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -157,13 +157,6 @@ bool Vector2::operator!=(const Vector2& p_vec2) const { return x!=p_vec2.x || y!=p_vec2.y; } -bool Vector2::nan_equals(const Vector2& p_vec2) const { - - return (x==p_vec2.x && y==p_vec2.y) || - (x==p_vec2.x && isnan(y) && isnan(p_vec2.y)) || - (isnan(x) && isnan(p_vec2.x) && y == p_vec2.y); -} - Vector2 Vector2::floor() const { return Vector2( Math::floor(x), Math::floor(y) ); diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 6dd8799ba2c..a24c4266eec 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -133,7 +133,6 @@ struct Vector2 { bool operator<(const Vector2& p_vec2) const { return (x==p_vec2.x)?(y(p_a._data._mem))m_op(*reinterpret_cast(p_b._data._mem)));\ + case m_name: _RETURN( *reinterpret_cast(p_a._data._mem) m_op *reinterpret_cast(p_b._data._mem));\ default: {}\ }\ r_valid=false;\ return;} + #define DEFAULT_OP_LOCALMEM_NEG(m_name,m_type)\ case m_name: {\ _RETURN( -*reinterpret_cast(p_a._data._mem));\ @@ -188,28 +177,13 @@ r_valid=false;\ return;} #define DEFAULT_OP_ARRAY_EQ(m_name,m_type)\ -DEFAULT_OP_ARRAY_OP(m_name,m_type,!=,!=,true,false,false,true) - -#define DEFAULT_OP_ARRAY_EQ_NAN(m_name,m_type)\ - DEFAULT_ARRAY_OP_HEAD(m_name,m_type,!=,false,false)\ - if ((ra[i] != rb[i]) && (isnan(ra[i]) != isnan(rb[i])))\ - _RETURN(false);\ - DEFAULT_ARRAY_OP_FOOT(true) - -#define DEFAULT_OP_ARRAY_EQ_NAN_V(m_name,m_type)\ -DEFAULT_OP_ARRAY_OP(m_name,m_type,!=,.nan_equals,true,false,false,false) +DEFAULT_OP_ARRAY_OP(m_name,m_type,!=,!=,true,false,false) #define DEFAULT_OP_ARRAY_LT(m_name,m_type)\ -DEFAULT_OP_ARRAY_OP(m_name,m_type,<,!=,false,a_len::Read ra = array_a.read();\ PoolVector::Read rb = array_b.read();\ \ for(int i=0;i