Make a distinction between a null-pointer and the value of 0

This commit is contained in:
Erik Hofman 2017-01-19 23:14:39 +01:00
parent ef2eb635af
commit 9e1aaa8b56
3 changed files with 3 additions and 3 deletions

View File

@ -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<T,2>(d); }
{ _data = d ? simd4_t<T,2>(d) : simd4_t<T,2>(T(0)); }
template<typename S>
explicit SGVec2(const SGVec2<S>& d)
{ data()[0] = d[0]; data()[1] = d[1]; }

View File

@ -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<T,3>(d); }
{ _data = d ? simd4_t<T,3>(d) : simd4_t<T,3>(T(0)); }
template<typename S>
explicit SGVec3(const SGVec3<S>& d)
{ data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; }

View File

@ -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<T,4>(d); }
{ _data = d ? simd4_t<T,4>(d) : simd4_t<T,4>(T(0)); }
template<typename S>
explicit SGVec4(const SGVec4<S>& d)
{ data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; data()[3] = d[3]; }