From 06b5264a30777863d1da563c70e9f340cb018adb Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Fri, 8 Feb 2019 10:37:37 +0100 Subject: [PATCH] prevent warning, add comment --- Framework/Particles/ParticleProperties.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Framework/Particles/ParticleProperties.cc b/Framework/Particles/ParticleProperties.cc index b90a744b..d59846fc 100644 --- a/Framework/Particles/ParticleProperties.cc +++ b/Framework/Particles/ParticleProperties.cc @@ -30,9 +30,10 @@ namespace corsika::particles { Code ConvertFromPDG(PDGCode p) { static_assert(detail::conversionArray.size() % 2 == 1); - auto constexpr maxPDG{(detail::conversionArray.size() - 1) >> 1}; + // this will fail, for the strange case where the maxPDG is negative... + unsigned int constexpr maxPDG{(detail::conversionArray.size() - 1) >> 1}; auto k = static_cast<PDGCodeType>(p); - if (abs(k) <= maxPDG) { + if ((unsigned int)abs(k) <= maxPDG) { return detail::conversionArray[k + maxPDG]; } else { return detail::conversionMap.at(p); -- GitLab