From 2646de559b5675f895904de4a211f862642e89c5 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 23 Mar 2020 09:47:51 +1100 Subject: Replace const with constexpr where possible. --- src/Document.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Document.cxx b/src/Document.cxx index b51d30c0c..d60cef3bb 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -95,7 +95,7 @@ void ActionDuration::AddSample(size_t numberActions, double durationOfActions) n // Alpha value for exponential smoothing. // Most recent value contributes 25% to smoothed value. - const double alpha = 0.25; + constexpr double alpha = 0.25; const double durationOne = durationOfActions / numberActions; duration = std::clamp(alpha * durationOne + (1.0 - alpha) * duration, @@ -2026,7 +2026,7 @@ Sci::Position Document::FindText(Sci::Position minPos, Sci::Position maxPos, con break; } } else if (SC_CP_UTF8 == dbcsCodePage) { - const size_t maxFoldingExpansion = 4; + constexpr size_t maxFoldingExpansion = 4; std::vector searchThing((lengthFind+1) * UTF8MaxBytes * maxFoldingExpansion + 1); const size_t lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind); @@ -2078,8 +2078,8 @@ Sci::Position Document::FindText(Sci::Position minPos, Sci::Position maxPos, con } } } else if (dbcsCodePage) { - const size_t maxBytesCharacter = 2; - const size_t maxFoldingExpansion = 4; + constexpr size_t maxBytesCharacter = 2; + constexpr size_t maxFoldingExpansion = 4; std::vector searchThing((lengthFind+1) * maxBytesCharacter * maxFoldingExpansion + 1); const size_t lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind); while (forward ? (pos < endPos) : (pos >= endPos)) { -- cgit v1.2.3