diff --git a/common/plugins/altium/altium_parser.cpp b/common/plugins/altium/altium_parser.cpp index 5f9f412e77..2b61bb999e 100644 --- a/common/plugins/altium/altium_parser.cpp +++ b/common/plugins/altium/altium_parser.cpp @@ -176,7 +176,7 @@ std::map ALTIUM_PARSER::ReadProperties() int32_t ALTIUM_PARSER::ConvertToKicadUnit( const double aValue ) { - const double int_limit = ( std::numeric_limits::max() - 1 ) / 2.54; + constexpr double int_limit = ( std::numeric_limits::max() - 1 ) / 2.54; int32_t iu = KiROUND( Clamp( -int_limit, aValue, int_limit ) * 2.54 ); diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index fbe9d4ad8f..469f8fe0dc 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -448,7 +448,7 @@ int SCH_SEXPR_PARSER::parseInternalUnits() // Schematic internal units are represented as integers. Any values that are // larger or smaller than the schematic units represent undefined behavior for // the system. Limit values to the largest that can be displayed on the screen. - double int_limit = std::numeric_limits::max() * 0.7071; // 0.7071 = roughly 1/sqrt(2) + constexpr double int_limit = std::numeric_limits::max() * 0.7071; // 0.7071 = roughly 1/sqrt(2) return KiROUND( Clamp( -int_limit, retval, int_limit ) ); } @@ -458,7 +458,7 @@ int SCH_SEXPR_PARSER::parseInternalUnits( const char* aExpected ) { auto retval = parseDouble( aExpected ) * IU_PER_MM; - double int_limit = std::numeric_limits::max() * 0.7071; + constexpr double int_limit = std::numeric_limits::max() * 0.7071; return KiROUND( Clamp( -int_limit, retval, int_limit ) ); } diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 38e86bb3ed..eb08c2e502 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -208,7 +208,8 @@ int PCB_PARSER::parseBoardUnits() // larger or smaller than those board units represent undefined behavior for // the system. We limit values to the largest that is visible on the screen // This is the diagonal distance of the full screen ~1.5m - double int_limit = std::numeric_limits::max() * 0.7071; // 0.7071 = roughly 1/sqrt(2) + constexpr double int_limit = + std::numeric_limits::max() * 0.7071; // 0.7071 = roughly 1/sqrt(2) return KiROUND( Clamp( -int_limit, retval, int_limit ) ); } @@ -220,7 +221,7 @@ int PCB_PARSER::parseBoardUnits( const char* aExpected ) // N.B. we currently represent board units as integers. Any values that are // larger or smaller than those board units represent undefined behavior for // the system. We limit values to the largest that is visible on the screen - double int_limit = std::numeric_limits::max() * 0.7071; + constexpr double int_limit = std::numeric_limits::max() * 0.7071; // Use here #KiROUND, not EKIROUND (see comments about them) when having a function as // argument, because it will be called twice with #KIROUND.