mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Use std::min and std::max
This commit is contained in:
@@ -4,14 +4,11 @@
|
||||
#include "../apps_container.h"
|
||||
#include <poincare/preferences.h>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace Poincare;
|
||||
using namespace Shared;
|
||||
|
||||
static inline float minFloat(float x, float y) { return x < y ? x : y; }
|
||||
static inline float maxFloat(float x, float y) { return x > y ? x : y; }
|
||||
static inline int maxInt(int x, int y) { return x > y ? x : y; }
|
||||
|
||||
namespace Regression {
|
||||
|
||||
GraphController::GraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, Store * store, CurveViewCursor * cursor, uint32_t * modelVersion, uint32_t * previousModelsVersions, uint32_t * rangeVersion, int * selectedDotIndex, int * selectedSeriesIndex) :
|
||||
@@ -165,7 +162,7 @@ void GraphController::reloadBannerView() {
|
||||
}
|
||||
if (!coefficientsAreDefined) {
|
||||
// Force the "Data not suitable" message to be on the next line
|
||||
int numberOfCharToCompleteLine = maxInt(Ion::Display::Width / BannerView::Font()->glyphSize().width() - strlen(I18n::translate(formula)), 0);
|
||||
int numberOfCharToCompleteLine = std::max(Ion::Display::Width / BannerView::Font()->glyphSize().width() - strlen(I18n::translate(formula)), 0);
|
||||
numberOfChar = 0;
|
||||
// Padding
|
||||
Shared::TextHelpers::PadWithSpaces(buffer, bufferSize, &numberOfChar, numberOfCharToCompleteLine - 1);
|
||||
@@ -390,8 +387,8 @@ InteractiveCurveViewRangeDelegate::Range GraphController::computeYRange(Interact
|
||||
for (int series = 0; series < Store::k_numberOfSeries; series++) {
|
||||
for (int k = 0; k < m_store->numberOfPairsOfSeries(series); k++) {
|
||||
if (m_store->xMin() <= m_store->get(series, 0, k) && m_store->get(series, 0, k) <= m_store->xMax()) {
|
||||
minY = minFloat(minY, m_store->get(series, 1, k));
|
||||
maxY = maxFloat(maxY, m_store->get(series, 1, k));
|
||||
minY = std::min(minY, m_store->get(series, 1, k));
|
||||
maxY = std::max(maxY, m_store->get(series, 1, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user