mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Fixed search of indices on tiny charts in statistics.
This commit is contained in:
parent
909f3bf011
commit
856f39c123
2 changed files with 3 additions and 2 deletions
|
@ -99,6 +99,7 @@ int StatisticalChart::findStartIndex(float64 v) const {
|
|||
}
|
||||
|
||||
int StatisticalChart::findEndIndex(int left, float64 v) const {
|
||||
const auto wasLeft = left;
|
||||
const auto n = int(xPercentage.size());
|
||||
if (v == 1.) {
|
||||
return n - 1;
|
||||
|
@ -120,7 +121,7 @@ int StatisticalChart::findEndIndex(int left, float64 v) const {
|
|||
left = middle + 1;
|
||||
}
|
||||
}
|
||||
return right;
|
||||
return std::max(wasLeft, right);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ void SegmentTree::build(int v, int from, int size) {
|
|||
|
||||
int SegmentTree::rMaxQ(int from, int to) {
|
||||
if (_array.size() < kMinArraySize) {
|
||||
auto max = std::numeric_limits<int>::min();
|
||||
auto max = 0;
|
||||
from = std::max(from, 0);
|
||||
to = std::min(to, int(_array.size() - 1));
|
||||
for (auto i = from; i <= to; i++) {
|
||||
|
|
Loading…
Add table
Reference in a new issue