mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 09:17:23 +01:00
Use std::min and std::max
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
#include "expression_model_list_controller.h"
|
||||
#include <apps/constant.h>
|
||||
#include <poincare/symbol.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Shared {
|
||||
|
||||
static inline int minInt(int x, int y) { return x < y ? x : y; }
|
||||
|
||||
/* Table Data Source */
|
||||
|
||||
ExpressionModelListController::ExpressionModelListController(Responder * parentResponder, I18n::Message text) :
|
||||
@@ -121,7 +120,7 @@ int ExpressionModelListController::memoizedIndexFromCumulatedHeight(KDCoordinate
|
||||
|
||||
KDCoordinate currentCumulatedHeight = memoizedCumulatedHeightFromIndex(currentSelectedRow);
|
||||
if (offsetY > currentCumulatedHeight) {
|
||||
int iMax = minInt(k_memoizedCellsCount/2 + 1, rowsCount - currentSelectedRow);
|
||||
int iMax = std::min(k_memoizedCellsCount/2 + 1, rowsCount - currentSelectedRow);
|
||||
for (int i = 0; i < iMax; i++) {
|
||||
currentCumulatedHeight+= memoizedRowHeight(currentSelectedRow + i);
|
||||
if (offsetY <= currentCumulatedHeight) {
|
||||
@@ -129,7 +128,7 @@ int ExpressionModelListController::memoizedIndexFromCumulatedHeight(KDCoordinate
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int iMax = minInt(k_memoizedCellsCount/2, currentSelectedRow);
|
||||
int iMax = std::min(k_memoizedCellsCount/2, currentSelectedRow);
|
||||
for (int i = 1; i <= iMax; i++) {
|
||||
currentCumulatedHeight-= memoizedRowHeight(currentSelectedRow-i);
|
||||
if (offsetY > currentCumulatedHeight) {
|
||||
|
||||
Reference in New Issue
Block a user