diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-13 16:27:30 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-13 16:27:30 +0200 |
commit | f219c05f0f53ee8b8f5dbe24318678be6c255dd9 (patch) | |
tree | 1e7a3a9692c6ca2bde130e48e3e476fb0c907d18 /src | |
parent | 17c5e925fb928d9c0926d8495a2db7a7b464c15f (diff) | |
download | px4-firmware-f219c05f0f53ee8b8f5dbe24318678be6c255dd9.tar.gz px4-firmware-f219c05f0f53ee8b8f5dbe24318678be6c255dd9.tar.bz2 px4-firmware-f219c05f0f53ee8b8f5dbe24318678be6c255dd9.zip |
Fix a set of C++ warnings in mathlib
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/mathlib/math/Matrix.hpp | 23 | ||||
-rw-r--r-- | src/lib/mathlib/math/Vector.hpp | 9 |
2 files changed, 20 insertions, 12 deletions
diff --git a/src/lib/mathlib/math/Matrix.hpp b/src/lib/mathlib/math/Matrix.hpp index ea0cf4ca1..c2109b479 100644 --- a/src/lib/mathlib/math/Matrix.hpp +++ b/src/lib/mathlib/math/Matrix.hpp @@ -69,27 +69,32 @@ public: /** * trivial ctor - * note that this ctor will not initialize elements + * Initializes the elements to zero. */ - MatrixBase() { - arm_mat = {M, N, &data[0][0]}; + MatrixBase() : + data{}, + arm_mat{M, N, &data[0][0]} + { } /** * copyt ctor */ - MatrixBase(const MatrixBase<M, N> &m) { - arm_mat = {M, N, &data[0][0]}; + MatrixBase(const MatrixBase<M, N> &m) : + arm_mat{M, N, &data[0][0]} + { memcpy(data, m.data, sizeof(data)); } - MatrixBase(const float *d) { - arm_mat = {M, N, &data[0][0]}; + MatrixBase(const float *d) : + arm_mat{M, N, &data[0][0]} + { memcpy(data, d, sizeof(data)); } - MatrixBase(const float d[M][N]) { - arm_mat = {M, N, &data[0][0]}; + MatrixBase(const float d[M][N]) : + arm_mat{M, N, &data[0][0]} + { memcpy(data, d, sizeof(data)); } diff --git a/src/lib/mathlib/math/Vector.hpp b/src/lib/mathlib/math/Vector.hpp index c7323c215..5017b7c79 100644 --- a/src/lib/mathlib/math/Vector.hpp +++ b/src/lib/mathlib/math/Vector.hpp @@ -69,10 +69,13 @@ public: /** * trivial ctor - * note that this ctor will not initialize elements + * initializes elements to zero */ - VectorBase() { - arm_col = {N, 1, &data[0]}; + VectorBase() : + data{}, + arm_col{N, 1, &data[0]} + { + } /** |