From 25c04553488bb86470592a1cdccac56979bf59bb Mon Sep 17 00:00:00 2001 From: kamilritz Date: Mon, 10 Aug 2020 08:03:37 +0200 Subject: [PATCH] comply with Firmware style requirements --- matrix/SparseVector.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/matrix/SparseVector.hpp b/matrix/SparseVector.hpp index 7e1631183be5..2940076e50b5 100644 --- a/matrix/SparseVector.hpp +++ b/matrix/SparseVector.hpp @@ -26,10 +26,13 @@ class SparseVector { static constexpr size_t _indices[N] {Idxs...}; static constexpr bool duplicateIndices() { - for (size_t i = 0; i < N; i++) - for (size_t j = 0; j < i; j++) - if (_indices[i] == _indices[j]) + for (size_t i = 0; i < N; i++) { + for (size_t j = 0; j < i; j++) { + if (_indices[i] == _indices[j]) { return true; + } + } + } return false; } static constexpr size_t findMaxIndex() { @@ -42,7 +45,7 @@ class SparseVector { return maxIndex; } - static_assert(duplicateIndices() == false, "Duplicate indices"); + static_assert(!duplicateIndices(), "Duplicate indices"); static_assert(N < M, "More entries than elements, use a dense vector"); static_assert(N > 0, "A sparse vector needs at least one element"); static_assert(findMaxIndex() < M, "Largest entry doesn't fit in sparse vector");