From 577e659486c3f5adab0ddf70a5fb4d8a8a8ecb45 Mon Sep 17 00:00:00 2001
From: "se.gorbunov" <se.gorbunov@gsi.de>
Date: Tue, 6 Sep 2022 00:18:51 +0000
Subject: [PATCH] L1: SIMD vectors: remove IsNanAny()

---
 reco/L1/L1Algo/L1NaN.h        |  2 +-
 reco/L1/vectors/L1vecPseudo.h | 19 +++++++++----------
 reco/L1/vectors/L1vecVc.h     | 10 ----------
 3 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/reco/L1/L1Algo/L1NaN.h b/reco/L1/L1Algo/L1NaN.h
index 667ce9d4c4..55cf40a527 100644
--- a/reco/L1/L1Algo/L1NaN.h
+++ b/reco/L1/L1Algo/L1NaN.h
@@ -64,7 +64,7 @@ namespace L1NaN
   template<typename T, typename std::enable_if<std::is_same<T, fvec>::value, T>::type* = nullptr>
   bool IsNaN(T value)
   {
-    return IsNanAny(value);  // NOTE: Here we consider fvec a NaN if at least one of its words is NaN
+    return isnan(value).isNotEmpty();  // NOTE: Here we consider fvec a NaN if at least one of its words is NaN
   }
 };  // namespace L1NaN
 
diff --git a/reco/L1/vectors/L1vecPseudo.h b/reco/L1/vectors/L1vecPseudo.h
index 28abbbe388..201b8dc4f7 100644
--- a/reco/L1/vectors/L1vecPseudo.h
+++ b/reco/L1/vectors/L1vecPseudo.h
@@ -189,6 +189,15 @@ public:
   friend fmask operator>=(const fvec& a, const fvec& b) { _opComp(a, b, >=) }
   friend fmask operator==(const fvec& a, const fvec& b) { _opComp(a, b, ==) }
 
+  friend fmask isnan(const fvec& a)
+  {
+    fmask m;
+    for (int i = 0; i < size(); i++) {
+      m[i] = std::isnan(a[i[);
+    }
+    return m;
+  }
+
   friend fvec iif(fmask a, fvec b, fvec c)
   {
     fvec z;
@@ -277,16 +286,6 @@ inline bool IsHorizontallyEqual(const fvec& v)
   return ret;
 }
 
-/// Checks, if any of the bands is NaN
-inline bool IsNanAny(const fvec& v)
-{
-  bool ret = false;
-  for (int i = 0; i < fvec::size(); i++) {
-    ret = ret || std::isnan(v[i]);
-  }
-  return ret;
-}
-
 
 #include "std_alloc.h"
 
diff --git a/reco/L1/vectors/L1vecVc.h b/reco/L1/vectors/L1vecVc.h
index 08253a0c73..b0d3c16863 100644
--- a/reco/L1/vectors/L1vecVc.h
+++ b/reco/L1/vectors/L1vecVc.h
@@ -39,16 +39,6 @@ inline bool IsHorizontallyEqual(const fvec& v)
   return ret;
 }
 
-/// Checks, if any of the bands is NaN
-inline bool IsNanAny(const fvec& v)
-{
-  bool ret = false;
-  for (size_t i = 0; i < fvec::size(); i++) {
-    ret = ret || std::isnan(v[i]);
-  }
-  return ret;
-}
-
 
 #include "std_alloc.h"
 
-- 
GitLab