Browse Source

Make default constructor cause Vector to be uninitialized.

tags/v1.1.0
Andrew Belt 5 years ago
parent
commit
9f9e85d691
1 changed files with 4 additions and 12 deletions
  1. +4
    -12
      include/simd/vector.hpp

+ 4
- 12
include/simd/vector.hpp View File

@@ -40,8 +40,8 @@ struct Vector<float, 4> {
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<float, 4> {
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, 4> {
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<int32_t, 4> {
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();
}


Loading…
Cancel
Save