Use std::min and std::max

This commit is contained in:
Romain Goyet
2020-04-12 15:43:39 -04:00
committed by Ecco
parent 77ee5126e1
commit 950862f8d0
79 changed files with 297 additions and 406 deletions

View File

@@ -7,14 +7,13 @@
#include <string.h>
#include <cmath>
#include <assert.h>
#include <algorithm>
using namespace Ion;
using namespace Poincare;
namespace Shared {
static inline int maxInt(int x, int y) { return x > y ? x : y; }
ExpressionModel::ExpressionModel() :
m_expression(),
m_layout(),
@@ -126,7 +125,7 @@ Ion::Storage::Record::ErrorStatus ExpressionModel::setExpressionContent(Ion::Sto
size_t newDataSize = previousDataSize - previousExpressionSize + newExpressionSize;
void * expAddress = expressionAddress(record);
// Update size of record to maximal size between previous and new data
newData.size = maxInt(previousDataSize, newDataSize);
newData.size = std::max(previousDataSize, newDataSize);
Ion::Storage::Record::ErrorStatus error = record->setValue(newData);
if (error != Ion::Storage::Record::ErrorStatus::None) {
assert(error == Ion::Storage::Record::ErrorStatus::NotEnoughSpaceAvailable);