diff --git a/SofaKernel/modules/SofaHelper/src/sofa/helper/RandomGenerator.cpp b/SofaKernel/modules/SofaHelper/src/sofa/helper/RandomGenerator.cpp index 4ddd3c32b9d..f636718237b 100644 --- a/SofaKernel/modules/SofaHelper/src/sofa/helper/RandomGenerator.cpp +++ b/SofaKernel/modules/SofaHelper/src/sofa/helper/RandomGenerator.cpp @@ -43,8 +43,6 @@ namespace sofa namespace helper { -const unsigned long RandomGenerator::RANDOM_BASE_MAX = 4294967295U; - RandomGenerator::RandomGenerator() { __rand48_seed[0] = RAND48_SEED_0; diff --git a/SofaKernel/modules/SofaHelper/src/sofa/helper/RandomGenerator.h b/SofaKernel/modules/SofaHelper/src/sofa/helper/RandomGenerator.h index a1eee9d5867..bda2b5a39fe 100644 --- a/SofaKernel/modules/SofaHelper/src/sofa/helper/RandomGenerator.h +++ b/SofaKernel/modules/SofaHelper/src/sofa/helper/RandomGenerator.h @@ -92,7 +92,7 @@ class SOFA_HELPER_API RandomGenerator } private: - static const unsigned long RANDOM_BASE_MAX; + static constexpr unsigned long RANDOM_BASE_MAX = 4294967295U; }; diff --git a/SofaKernel/modules/SofaHelper/src/sofa/helper/rmath.h b/SofaKernel/modules/SofaHelper/src/sofa/helper/rmath.h index 15739539281..22824b01170 100644 --- a/SofaKernel/modules/SofaHelper/src/sofa/helper/rmath.h +++ b/SofaKernel/modules/SofaHelper/src/sofa/helper/rmath.h @@ -72,7 +72,7 @@ inline int rnear(double r) template inline int rfloor(real r) { - static const double FLOATTOINTCONST=(1.5*(1LL<<(52-16))); + static constexpr double FLOATTOINTCONST=(1.5*(1LL<<(52-16))); union { double d; @@ -85,7 +85,7 @@ inline int rfloor(real r) template inline int rnear(real r) { - static const double FLOATTOINTCONST_0_5=(1.5*(1LL<<(52-16)))+0.5; + static constexpr double FLOATTOINTCONST_0_5=(1.5*(1LL<<(52-16)))+0.5; union { double d; diff --git a/modules/SofaGuiCommon/src/sofa/gui/BatchGUI.cpp b/modules/SofaGuiCommon/src/sofa/gui/BatchGUI.cpp index 2c990b3ae4c..5c271680c00 100644 --- a/modules/SofaGuiCommon/src/sofa/gui/BatchGUI.cpp +++ b/modules/SofaGuiCommon/src/sofa/gui/BatchGUI.cpp @@ -40,7 +40,7 @@ namespace sofa::gui using sofa::helper::AdvancedTimer; -const signed int BatchGUI::DEFAULT_NUMBER_OF_ITERATIONS = 1000; +constexpr signed int BatchGUI::DEFAULT_NUMBER_OF_ITERATIONS = 1000; signed int BatchGUI::nbIter = BatchGUI::DEFAULT_NUMBER_OF_ITERATIONS; std::string BatchGUI::nbIterInp=""; BatchGUI::BatchGUI() diff --git a/modules/SofaGuiCommon/src/sofa/gui/ColourPickingVisitor.cpp b/modules/SofaGuiCommon/src/sofa/gui/ColourPickingVisitor.cpp index acb777b3530..bd0f26f7086 100644 --- a/modules/SofaGuiCommon/src/sofa/gui/ColourPickingVisitor.cpp +++ b/modules/SofaGuiCommon/src/sofa/gui/ColourPickingVisitor.cpp @@ -43,7 +43,7 @@ using namespace sofa::core::collision; namespace { -const float threshold = std::numeric_limits::min(); +constexpr float threshold = std::numeric_limits::min(); } void decodeCollisionElement(const sofa::type::Vec4f colour, sofa::component::collision::BodyPicked& body)