diff --git a/Framework/Particles/ParticleProperties.cc b/Framework/Particles/ParticleProperties.cc index b90a744bd38f5dc2755a2f10753af2e7c7386081..d59846fcf207e9c8a04c0f763bcbad4d5bfbe732 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);