From 9e1aaa8b56ab036de5afe288abe857d5a57c6c92 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Thu, 19 Jan 2017 23:14:39 +0100 Subject: [PATCH] Make a distinction between a null-pointer and the value of 0 --- simgear/math/SGVec2.hxx | 2 +- simgear/math/SGVec3.hxx | 2 +- simgear/math/SGVec4.hxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/simgear/math/SGVec2.hxx b/simgear/math/SGVec2.hxx index ec46475e..d1284d8e 100644 --- a/simgear/math/SGVec2.hxx +++ b/simgear/math/SGVec2.hxx @@ -49,7 +49,7 @@ public: /// Constructor. Initialize by the content of a plain array, /// make sure it has at least 2 elements explicit SGVec2(const T* d) - { _data = simd4_t(d); } + { _data = d ? simd4_t(d) : simd4_t(T(0)); } template explicit SGVec2(const SGVec2& d) { data()[0] = d[0]; data()[1] = d[1]; } diff --git a/simgear/math/SGVec3.hxx b/simgear/math/SGVec3.hxx index e3964157..904ec1a8 100644 --- a/simgear/math/SGVec3.hxx +++ b/simgear/math/SGVec3.hxx @@ -59,7 +59,7 @@ public: /// Constructor. Initialize by the content of a plain array, /// make sure it has at least 3 elements explicit SGVec3(const T* d) - { _data = simd4_t(d); } + { _data = d ? simd4_t(d) : simd4_t(T(0)); } template explicit SGVec3(const SGVec3& d) { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; } diff --git a/simgear/math/SGVec4.hxx b/simgear/math/SGVec4.hxx index bc7f2468..94fc8f52 100644 --- a/simgear/math/SGVec4.hxx +++ b/simgear/math/SGVec4.hxx @@ -46,7 +46,7 @@ public: /// Constructor. Initialize by the content of a plain array, /// make sure it has at least 3 elements explicit SGVec4(const T* d) - { _data = simd4_t(d); } + { _data = d ? simd4_t(d) : simd4_t(T(0)); } template explicit SGVec4(const SGVec4& d) { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; data()[3] = d[3]; }