mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/calculation] Correct error in ring buffer methods
Change-Id: I684afe462d23384a4807644586c03ea654ed7c8a
This commit is contained in:
@@ -20,16 +20,17 @@ Calculation * CalculationStore::push(Calculation * c) {
|
||||
Calculation * CalculationStore::calculationAtIndex(int i) {
|
||||
int j = 0;
|
||||
Calculation * currentCalc = m_start;
|
||||
while (j<=i) {
|
||||
Calculation * previousCalc = nullptr;
|
||||
while (j <= i) {
|
||||
if (!currentCalc++->isEmpty()) {
|
||||
previousCalc = currentCalc - 1;
|
||||
j++;
|
||||
}
|
||||
if (currentCalc >= m_calculations + k_maxNumberOfCalculations) {
|
||||
currentCalc = m_calculations;
|
||||
}
|
||||
if (!currentCalc->isEmpty()) {
|
||||
j++;
|
||||
}
|
||||
currentCalc++;
|
||||
}
|
||||
return currentCalc-1;
|
||||
return previousCalc;
|
||||
}
|
||||
|
||||
int CalculationStore::numberOfCalculations() {
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
namespace Calculation {
|
||||
|
||||
// TODO: make tests for the ring buffer
|
||||
|
||||
class CalculationStore {
|
||||
public:
|
||||
CalculationStore();
|
||||
|
||||
Reference in New Issue
Block a user