[Solved] Can't fill up AbstractFifo - (totalSize - 1) is the max allowed?


#1

Hi,

What is the reason for AbstractFifo not allowing all of the “slots” to be filled up (maximum is the capacity - 1)?

void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const noexcept
{
    ...
    numToWrite = jmin (numToWrite, freeSpace - 1);
    ...
}

#2

#3

Thanks @chkn!
I’m sorry, I don’t know how I didn’t see that when I searched.


#4

PS: maybe the variables need to be renamed, “freeSpace” is little-bit misleading


#5

A dumb question, btw - can’t this all be resolved by adding 1 to the the freeSpace? (I mean if the implementation changed in this way not manually doing so when instantiating or resizing the fifo)