Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[all] Variable can be made constexpr #2472

Merged
merged 2 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ namespace sofa
namespace helper
{

const unsigned long RandomGenerator::RANDOM_BASE_MAX = 4294967295U;

RandomGenerator::RandomGenerator()
{
__rand48_seed[0] = RAND48_SEED_0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

};

Expand Down
4 changes: 2 additions & 2 deletions SofaKernel/modules/SofaHelper/src/sofa/helper/rmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ inline int rnear(double r)
template<class real>
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;
Expand All @@ -85,7 +85,7 @@ inline int rfloor(real r)
template<class real>
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;
Expand Down
2 changes: 1 addition & 1 deletion modules/SofaGuiCommon/src/sofa/gui/BatchGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using namespace sofa::core::collision;

namespace
{
const float threshold = std::numeric_limits<float>::min();
constexpr float threshold = std::numeric_limits<float>::min();
}

void decodeCollisionElement(const sofa::type::Vec4f colour, sofa::component::collision::BodyPicked& body)
Expand Down