diff --git a/reco/L1/L1Algo/L1Field.cxx b/reco/L1/L1Algo/L1Field.cxx index 15d8df849d968565d11753bcba90274613d1381c..d2591e1a4c17a5f4bb121f5384a78c842a25d560 100644 --- a/reco/L1/L1Algo/L1Field.cxx +++ b/reco/L1/L1Algo/L1Field.cxx @@ -67,26 +67,9 @@ void L1FieldSlice::CheckConsistency() const { /* Check SIMD data vectors for consistent initialization */ for (int i = 0; i < L1Constants::size::kMaxNFieldApproxCoefficients; ++i) { - if (!IsHorizontallyEqual(cx[i])) { - std::stringstream msg; - msg << "L1FieldSlice: \"cx[" << i - << "]\" SIMD vector is inconsistent not all of the words are equal each other: " << cx[i]; - throw std::logic_error(msg.str()); - } - - if (!IsHorizontallyEqual(cy[i])) { - std::stringstream msg; - msg << "L1FieldSlice: \"cy[" << i - << "]\" SIMD vector is inconsistent not all of the words are equal each other: " << cy[i]; - throw std::logic_error(msg.str()); - } - - if (!IsHorizontallyEqual(cz[i])) { - std::stringstream msg; - msg << "L1FieldSlice: \"cz[" << i - << "]\" SIMD vector is inconsistent not all of the words are equal each other: " << cz[i]; - throw std::logic_error(msg.str()); - } + L1Utils::CheckSimdVectorEquality(cx[i], "L1FieldSlice: cx"); + L1Utils::CheckSimdVectorEquality(cy[i], "L1FieldSlice: cy"); + L1Utils::CheckSimdVectorEquality(cz[i], "L1FieldSlice: cz"); } } diff --git a/reco/L1/L1Algo/L1Utils.h b/reco/L1/L1Algo/L1Utils.h index 740c713c86564fe228e5021595a115cc9365b5cf..305d5025806f6d4d0e223940cd604d7bb4d41429 100644 --- a/reco/L1/L1Algo/L1Utils.h +++ b/reco/L1/L1Algo/L1Utils.h @@ -44,7 +44,11 @@ namespace L1Utils [[gnu::always_inline]] inline void CheckSimdVectorEquality(fvec v, const char* name) { - if (!IsHorizontallyEqual(v)) { + bool ok = true; + for (size_t i = 1; i < fvec::size(); i++) { + ok = ok && (v[i] == v[0]); + } + if (!ok) { std::stringstream msg; msg << name << " SIMD vector is inconsistent, not all of the words are equal each other: " << v; throw std::logic_error(msg.str()); diff --git a/reco/L1/vectors/L1vecPseudo.h b/reco/L1/vectors/L1vecPseudo.h index 201b8dc4f77ba2603b7f5bbd480b7ee3b4360b85..f8b5e22badde3838e90bc0c78bad471533759346 100644 --- a/reco/L1/vectors/L1vecPseudo.h +++ b/reco/L1/vectors/L1vecPseudo.h @@ -272,21 +272,6 @@ public: #define _fvecalignment __attribute__((aligned(fvec::size() * sizeof(fscal)))) - -/// Checks, if all bands are equal -/// NOTE: two values defined as signaling_NaN() are not equal, thus if there are all or one -/// of the words are kNaN, the function returns false -inline bool IsHorizontallyEqual(const fvec& v) -{ - fscal s = v[0]; - bool ret = true; - for (int i = 1; i < fvec::size(); i++) { - ret = ret && (v[i] == s); - } - return ret; -} - - #include "std_alloc.h" #endif diff --git a/reco/L1/vectors/L1vecVc.h b/reco/L1/vectors/L1vecVc.h index b0d3c168636ea26b91183e27d9d31b3bf1a95d75..b38e36bc45c965ef0b844ce7ca92ea81fa400d1d 100644 --- a/reco/L1/vectors/L1vecVc.h +++ b/reco/L1/vectors/L1vecVc.h @@ -25,21 +25,6 @@ inline fvec operator+(const fvec& a, fscal b) { return a + fvec(b); } inline fvec operator-(fscal a, const fvec& b) { return fvec(a) - b; } inline fvec operator-(const fvec& a, fscal b) { return a - fvec(b); } - -/// Checks, if all bands are equal -/// NOTE: two values defined as signaling_NaN() are not equal, thus if there are all or one -/// of the words are kNaN, the function returns false -inline bool IsHorizontallyEqual(const fvec& v) -{ - fscal s = v[0]; - bool ret = true; - for (size_t i = 1; i < fvec::size(); i++) { - ret = ret && (v[i] == s); - } - return ret; -} - - #include "std_alloc.h"