From 967e8235974e046ee15c30207568fc6d1a32929d Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Mon, 15 Apr 2019 17:54:55 -0300
Subject: [PATCH] moved sgn function into separate file for reuse

---
 Framework/Utilities/CMakeLists.txt |  1 +
 Framework/Utilities/COMBoost.cc    |  7 +------
 Framework/Utilities/sgn.h          | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 6 deletions(-)
 create mode 100644 Framework/Utilities/sgn.h

diff --git a/Framework/Utilities/CMakeLists.txt b/Framework/Utilities/CMakeLists.txt
index f55df764..763c534f 100644
--- a/Framework/Utilities/CMakeLists.txt
+++ b/Framework/Utilities/CMakeLists.txt
@@ -27,6 +27,7 @@ set (
   COMBoost.h
   Bit.h
   Singleton.h
+  sgn.h
   CorsikaFenv.h
   MetaProgramming.h
   )
diff --git a/Framework/Utilities/COMBoost.cc b/Framework/Utilities/COMBoost.cc
index a12b533b..a9464521 100644
--- a/Framework/Utilities/COMBoost.cc
+++ b/Framework/Utilities/COMBoost.cc
@@ -14,17 +14,12 @@
 #include <corsika/geometry/Vector.h>
 #include <corsika/units/PhysicalUnits.h>
 #include <corsika/utl/COMBoost.h>
+#include <corsika/utl/sgn.h>
 
 using namespace corsika::utl;
 using namespace corsika::units::si;
 using namespace corsika::geometry;
 
-//! sign function without branches
-template <typename T>
-static int sgn(T val) {
-  return (T(0) < val) - (val < T(0));
-}
-
 COMBoost::COMBoost(FourVector<HEPEnergyType, Vector<hepmomentum_d>> const& Pprojectile,
                    const HEPMassType massTarget)
     : fCS(Pprojectile.GetSpaceLikeComponents().GetCoordinateSystem()) {
diff --git a/Framework/Utilities/sgn.h b/Framework/Utilities/sgn.h
new file mode 100644
index 00000000..71d5bec5
--- /dev/null
+++ b/Framework/Utilities/sgn.h
@@ -0,0 +1,14 @@
+#ifndef _utilities_sgn_h
+#define _utilities_sgn_h
+
+namespace corsika::utl {
+
+//! sign function without branches
+template <typename T>
+static int sgn(T val) {
+  return (T(0) < val) - (val < T(0));
+}
+
+}
+
+#endif
-- 
GitLab