[apps/graph][apps/sequence] ValuesController memoization buffer does not

require the same size for Sequence and Graph
This commit is contained in:
Émilie Feral
2019-10-03 15:25:22 +02:00
committed by LeaNumworks
parent dc3c67a2d2
commit 60ad096956
4 changed files with 6 additions and 2 deletions

View File

@@ -72,10 +72,12 @@ private:
Shared::ContinuousFunction::PlotType plotTypeAtColumn(int * i) const;
// Function evaluation memoization
static constexpr int k_valuesCellBufferSize = 2*Poincare::PrintFloat::charSizeForFloatsWithPrecision(Poincare::Preferences::LargeNumberOfSignificantDigits)+3; // The largest buffer holds (-1.234567E-123;-1.234567E-123)
char * memoizedBufferAtIndex(int i) override {
assert(i >= 0 && i < k_maxNumberOfCells);
return m_memoizedBuffer[i];
}
int valuesCellBufferSize() const override { return k_valuesCellBufferSize; }
int numberOfMemoizedColumn() override { return k_maxNumberOfFunctions; }
/* The conversion of column coordinates from the absolute table to the table
* on only values cell depends on the number of abscissa columns which depends

View File

@@ -46,10 +46,12 @@ private:
Shared::Interval * intervalAtColumn(int columnIndex) override;
// Function evaluation memoization
static constexpr int k_valuesCellBufferSize = Poincare::PrintFloat::charSizeForFloatsWithPrecision(Poincare::Preferences::LargeNumberOfSignificantDigits);
char * memoizedBufferAtIndex(int i) override {
assert(i >= 0 && i < k_maxNumberOfCells);
return m_memoizedBuffer[i];
}
int valuesCellBufferSize() const override{ return k_valuesCellBufferSize; }
int numberOfMemoizedColumn() override { return k_maxNumberOfSequences; }
void fillMemoizedBuffer(int i, int j, int index) override;

View File

@@ -263,7 +263,7 @@ void ValuesController::resetMemoization() {
}
void ValuesController::moveMemoizedBuffer(int destinationI, int destinationJ, int sourceI, int sourceJ) {
strlcpy(memoizedBufferAtIndex(destinationJ*numberOfMemoizedColumn() + destinationI), memoizedBufferAtIndex(sourceJ*numberOfMemoizedColumn() + sourceI), k_valuesCellBufferSize);
strlcpy(memoizedBufferAtIndex(destinationJ*numberOfMemoizedColumn() + destinationI), memoizedBufferAtIndex(sourceJ*numberOfMemoizedColumn() + sourceI), valuesCellBufferSize());
}
char * ValuesController::memoizedBufferForCell(int i, int j) {

View File

@@ -81,7 +81,6 @@ protected:
* the titles and the abscissa columns)
* - the memoized table (which is a subset of the table of values cells)
*/
static constexpr int k_valuesCellBufferSize = 2*Poincare::PrintFloat::charSizeForFloatsWithPrecision(Poincare::Preferences::LargeNumberOfSignificantDigits)+3; // The largest buffer holds (-1.234567E-123;-1.234567E-123)
void resetMemoization();
virtual char * memoizedBufferAtIndex(int i) = 0;
virtual int numberOfMemoizedColumn() = 0;
@@ -106,6 +105,7 @@ private:
int absoluteRowForValuesRow(int row) { return row + 1; } // Add the title row
// Coordinates of memoizedBufferForCell refer to the absolute table
char * memoizedBufferForCell(int i, int j);
virtual int valuesCellBufferSize() const = 0;
// Coordinates of moveMemoizedBuffer refer to the memoized table
void moveMemoizedBuffer(int destinationI, int destinationJ, int sourceI, int sourceJ);
// Coordinates of fillMemoizedBuffer refer to the absolute table but the index