From 9f9e85d6912c03a774bc3447260e98dc688a9884 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 24 Jun 2019 00:10:40 -0400 Subject: [PATCH] Make default constructor cause Vector to be uninitialized. --- include/simd/vector.hpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/include/simd/vector.hpp b/include/simd/vector.hpp index 40e027eb..5a92a3c1 100644 --- a/include/simd/vector.hpp +++ b/include/simd/vector.hpp @@ -40,8 +40,8 @@ struct Vector { float s[4]; }; - /** Constructs a vector initialized to zero. */ - Vector() : v(_mm_setzero_ps()) {} + /** Constructs an uninitialized vector. */ + Vector() = default; /** Constructs a vector from a native `__m128` type. */ Vector(__m128 v) : v(v) {} @@ -51,16 +51,11 @@ struct Vector { v = _mm_set1_ps(x); } - /** Constructs a vector from four values. */ + /** Constructs a vector from four scalars. */ Vector(float x1, float x2, float x3, float x4) { v = _mm_setr_ps(x1, x2, x3, x4); } - /** Returns an uninitialized vector. */ - static Vector undefined() { - return Vector(_mm_undefined_ps()); - } - /** Returns a vector initialized to zero. */ static Vector zero() { return Vector(); @@ -110,7 +105,7 @@ struct Vector { int32_t s[4]; }; - Vector() : v(_mm_setzero_si128()) {} + Vector() = default; Vector(__m128i v) : v(v) {} Vector(int32_t x) { v = _mm_set1_epi32(x); @@ -118,9 +113,6 @@ struct Vector { Vector(int32_t x1, int32_t x2, int32_t x3, int32_t x4) { v = _mm_setr_epi32(x1, x2, x3, x4); } - static Vector undefined() { - return Vector(_mm_undefined_si128()); - } static Vector zero() { return Vector(); }