diff --git a/README.md b/README.md index 9457ffcd..b2d1f853 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,8 @@ *Rack* is the engine for the VCV open-source virtual modular synthesizer. -For information about the software, go to the [VCV website](https://vcvrack.com/) or the [VCV Rack manual](https://vcvrack.com/manual/). +- [VCV website](https://vcvrack.com/) +- [Manual](https://vcvrack.com/manual/index.html) +- [Building](https://vcvrack.com/manual/Building.html) +- [Communities](https://vcvrack.com/manual/Communities.html) +- [Licenses](LICENSE.md) diff --git a/include/helpers.hpp b/include/helpers.hpp index 470fce4a..b715ca29 100644 --- a/include/helpers.hpp +++ b/include/helpers.hpp @@ -17,7 +17,7 @@ namespace rack { template -plugin::Model *createModel(std::string slug) { +plugin::Model *createModel(const std::string &slug) { struct TModel : plugin::Model { engine::Module *createModule() override { TModule *m = new TModule; diff --git a/include/simd/vector.hpp b/include/simd/vector.hpp index 6f980ea8..ac66bec9 100644 --- a/include/simd/vector.hpp +++ b/include/simd/vector.hpp @@ -48,32 +48,41 @@ struct Vector; */ template <> struct Vector { - __m128 v; + union { + __m128 v; + float f[4]; + }; /** Constructs an uninitialized vector. */ - Vector() {} + Vector() {} /** Constructs a vector from a native `__m128` type. */ - Vector(__m128 v) : v(v) {} + Vector(__m128 v) : v(v) {} /** Constructs a vector with all elements set to `x`. */ - Vector(float x) { + Vector(float x) { v = _mm_set_ps1(x); } /** Constructs a vector from four values. */ - Vector(float x1, float x2, float x3, float x4) { + Vector(float x1, float x2, float x3, float x4) { v = _mm_set_ps(x1, x2, x3, x4); } /** Returns a vector initialized to zero. */ - static Vector zero() { - return Vector(_mm_setzero_ps()); + static Vector zero() { + return Vector(_mm_setzero_ps()); + } + + /** Returns a vector with all 1 bits. */ + static Vector mask() { + __m128 zero = _mm_setzero_ps(); + return Vector(_mm_cmpeq_ps(zero, zero)); } /** Reads an array of 4 values. */ - static Vector load(const float *x) { - return Vector(_mm_loadu_ps(x)); + static Vector load(const float *x) { + return Vector(_mm_loadu_ps(x)); } /** Writes an array of 4 values. */ @@ -178,9 +187,7 @@ inline float_4 operator--(float_4 &a, int) { /** `~a` */ inline float_4 operator~(const float_4 &a) { - float_4 mask = float_4::zero(); - mask = (mask == mask); - return a ^ mask; + return a ^ float_4::mask(); } diff --git a/src/plugin/Plugin.cpp b/src/plugin/Plugin.cpp index 98a9c53b..e7da130f 100644 --- a/src/plugin/Plugin.cpp +++ b/src/plugin/Plugin.cpp @@ -1,5 +1,6 @@ #include #include +#include namespace rack { @@ -13,6 +14,7 @@ Plugin::~Plugin() { } void Plugin::addModel(Model *model) { + assert(isSlugValid(model->slug)); assert(!model->plugin); model->plugin = this; models.push_back(model);