diff options
| author | Neil <nyamatongwe@gmail.com> | 2020-03-23 09:47:51 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2020-03-23 09:47:51 +1100 |
| commit | 48471c6743cb5eac8642c9cc680ec8657c8ea036 (patch) | |
| tree | eec3d2a7191400b14fd6060b7659421984003c2a /src | |
| parent | 6e7f7105447e81fed1e0ccc2545ca36fb7f05657 (diff) | |
| download | scintilla-mirror-48471c6743cb5eac8642c9cc680ec8657c8ea036.tar.gz | |
Backport: Replace const with constexpr where possible.
Backport of changeset 8020:3f5593341a23.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Document.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 9a068fcf8..4dd2f9fd6 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -98,7 +98,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 = Sci::clamp(alpha * durationOne + (1.0 - alpha) * duration, @@ -2029,7 +2029,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<char> searchThing((lengthFind+1) * UTF8MaxBytes * maxFoldingExpansion + 1); const size_t lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind); @@ -2081,8 +2081,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<char> searchThing((lengthFind+1) * maxBytesCharacter * maxFoldingExpansion + 1); const size_t lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind); while (forward ? (pos < endPos) : (pos >= endPos)) { |
